Forms & Controls
HTML <fieldset> element
Groups related form controls. A legend supplies a group caption; disabled affects most descendant controls except those in the first legend. Use legend as the group name for related controls. Disabling the fieldset disables most descendant controls, except those inside its first legend. A fieldset is not required around every single control. It accepts global HTML attributes; individual global features may be inapplicable or restricted.
Formal Syntax & Structure
html syntaxhtml
<fieldset> <legend>Group</legend> Controls</fieldset>Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| disabled | boolean | Disables supported controls or elements. Disabled form controls are generally not focusable, validated or submitted. The exact effect depends on the element; disabled="false" still disables. |
| form | form element ID | Associates an eligible control with a form elsewhere in the same document, overriding an ancestor form where applicable. Does not automatically associate descendants of a fieldset. |
| name | string | Provides an element-specific name: a form field key, radio group name, named frame, metadata key, slot name or other defined purpose. Its meaning depends on the element; it is not a unique DOM identifier. |
Return Value
HTMLFieldSetElement
Content model: Optional legend as first child, followed by flow content.
Working Example
Example Snippethtml
<!doctype html><html lang="en"> <head> <meta charset="utf-8"> <title>HTML example</title> </head> <body> <fieldset> <legend>Delivery</legend> <label> <input type="radio" name="delivery" value="pickup"> Pickup </label> <label> <input type="radio" name="delivery" value="post"> Post </label> </fieldset> </body></html>