The <optgroup> creates a grouping of options within a <select> element.
| Content categories | None. |
|---|---|
| Permitted content | Zero or more <option> elements. |
| Tag omission | The start tag is mandatory. The end tag is optional if this element is immediately followed by another <optgroup> element, or if the parent element has no more content. |
| Permitted parents | A <select> element. |
| Permitted ARIA roles | None |
| DOM interface | HTMLOptGroupElement |
This element includes the global attributes.
disabledlabel<select>
<optgroup label="Group 1">
<option>Option 1.1</option>
</optgroup>
<optgroup label="Group 2">
<option>Option 2.1</option>
<option>Option 2.2</option>
</optgroup>
<optgroup label="Group 3" disabled>
<option>Option 3.1</option>
<option>Option 3.2</option>
<option>Option 3.3</option>
</optgroup>
</select>
| Specification | Status | Comment |
|---|---|---|
| HTML Living Standard The definition of '<optgroup>' in that specification. | Living Standard | |
| HTML5 The definition of '<optgroup>' in that specification. | Recommendation | |
| HTML 4.01 Specification The definition of '<optgroup>' in that specification. | Recommendation |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | 1 | Yes | 1 | 5.5 | Yes | Yes |
disabled |
1 | Yes | 1 | 8 | Yes | Yes |
label |
1 | Yes | 1 | 5.5 | Yes | Yes |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | Yes | Yes | Yes | 4 | Yes | Yes | Yes |
disabled |
Yes | Yes | Yes | 4 | Yes | Yes | Yes |
label |
Yes | Yes | Yes | 4 | Yes | Yes | Yes |
<form>, <legend>, <label>, <button>, <select>, <datalist>, <option>, <fieldset>, <textarea>, <keygen>, <input>, <output>, <progress> and <meter>.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/optgroup