The <option>
is used to define an item contained in a <select>
, an <optgroup>
, or a <datalist>
element. As such, <option>
can represent menu items in popups and other lists of items in an HTML document.
Content categories | None. |
---|---|
Permitted content | Text, possibly with escaped characters (like é ). |
Tag omission | The start tag is mandatory. The end tag is optional if this element is immediately followed by another <option> element or an <optgroup> , or if the parent element has no more content. |
Permitted parents | A <select> , an <optgroup> or a <datalist> element. |
Permitted ARIA roles | None |
DOM interface | HTMLOptionElement |
This element includes the global attributes.
disabled
<optgroup>
element.label
label
attribute isn't defined, its value is that of the element text content.selected
<option>
element is the descendant of a <select>
element whose multiple
attribute is not set, only one single <option>
of this <select>
element may have the selected
attribute.value
See <select>
for examples.
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of '<option>' in that specification. | Living Standard | |
HTML5 The definition of '<option>' in that specification. | Recommendation | |
HTML 4.01 Specification The definition of '<option>' in that specification. | Recommendation | Initial definition |
Desktop | ||||||
---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
Basic support | 1 | Yes | 1 | Yes | Yes | Yes |
disabled |
1 | Yes | 1 | Yes | Yes | Yes |
label |
1 | Yes | 1
|
Yes | Yes | Yes |
selected |
1 | Yes | 1 | Yes | Yes | Yes |
value |
1 | Yes | 1 | Yes | 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 |
selected |
Yes | Yes | Yes | 4 | Yes | Yes | Yes |
value |
Yes | Yes | Yes | 4 | Yes | Yes | Yes |
<form>
, <legend>
, <label>
, <button>
, <select>
, <datalist>
, <optgroup>
, <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/option