Attributes · <optgroup>
Which <optgroup> attributes matter?
The group heading comes from label; disabled turns off every option in the group.
| Attribute | What it does | Docs |
|---|---|---|
label | Required. The visible group heading shown in the dropdown. It is not an option and cannot be selected or submitted. | MDN |
disabled | Boolean. Disables every <option> inside the group so none can be chosen or submitted. | MDN |
value (on option) | The string sent as name=value when this option is chosen. Without it, the option's text is sent instead. | MDN |
selected (on option) | Boolean. Makes this option the default choice when the page loads. | MDN |
disabled (on option) | Boolean. The option is shown but cannot be picked. Pair it with value="" and selected for a placeholder. | MDN |
required (on select) | Blocks submit while the selected option has an empty value, so a value="" placeholder forces a real choice. | MDN |




