It is used to define an item contained in a select list, that is, inside <select>
, <optgroup>
or <datalist>
elements.
If you have a long list of options, you can group related options within the <optgroup>
tag.
disabled
If this Boolean attribute is set, this option is not checkable. Often browsers grey out such control and it won't receive any browsing event, like mouse clicks or focus-related ones. If this attribute is not set, the element can still be disabled if one of its ancestors is a disabled <optgroup>
element.
label
This attribute is text for the label indicating the meaning of the option. If the label
attribute isn't defined, its value is that of the element text content.
selected
If present, this Boolean attribute indicates that the option is initially selected. If the <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
The content of this attribute represents the value to be submitted with the form, should this option be selected. If this attribute is omitted, the value is taken from the text content of the option element.
- Type: block
- Self-closing: No
- Semantic value: No
Top comments (0)