Advertisement
Home Open Editor ❯

HTML <select> disabled Attribute

Example

<label for="lang">Choose your option:</label>

<select name="language" id="lang" disabled>
  <option value="HTML">HTML</option>
  <option value="CSS">CSS</option>
  <option value="JavaScript">JavaScript</option>
</select>

Try this code ❯

Meaning

The disabled attribute is used to turn off a form control. Elements will not be submitted, nor can they receive any focus from the keyboard or mouse.

Disabled form controls will not be part of the tabbing order.

The browser also can gray out the form that is disabled, to indicate to the user that the form control is inactive.

This attribute requires no value under traditional HTML, but under XHTML variants it should be set to disabled="disabled".


Standard Syntax

<select disabled>
  <option>text</option>
</select>


Advertisement

Attribute Values

Value Description
disabled This is a boolean attribute, the presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value.
Home Open Editor ❯
Advertisement