HTML <option> Tag
In a <select>
, <datalist>
, or <optgroup>
tag, the HTML option tag generates an item. The item specified by the <option>
tag will appear in a list of values as one of the values.
The <option>
element is another frequent name for this tag.
Notes: The <option>
tag can be used without any attributes, however the value attribute, which specifies what is delivered to the server when the form is submitted, is normally required.
Tips: If you have a long list of options, use the <optgroup>
element to group them together.
Syntax
Attributes
Attribute | Value | Description |
---|---|---|
disabled | disabled | Indicates that an option should be turned off. |
label | text | For an option, specify a shorter label. |
selected | selected | When the page loads, this property specifies that an option should be pre-selected. |
value | text | Sets the value that will be transmitted to the server. |
Supported Browsers
Element | Chrome | Firefox | Safari | Edge / IE | Opera |
---|---|---|---|---|---|
<option> | Yes | Yes | Yes | Yes | Yes |