HTML <option> disabled Attribute
Example
<label for="lang">Choose a language:</label>
<select id="lang">
<option value="HTML disabled">HTML</option>
<option value="CSS">CSS</option>
<option value="JavaScript">JavaScript</option>
</select>
Meaning
The disabled attribute specidies that the particular item is not selectable.
Traditional HTML did not require a value for this attribute, but it should be set to disabled under XHTML (disabled="disabled").
This Boolean attribute is a Boolean attribute, it make option 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.
Standard Syntax
<option disabled>text</option>
Advertisement
Attribute Values
| Value | Description |
|---|---|
| disabled | Value is optional but Mandatory in XHTML |