disabled (HTML attribute)

Spec
Depr. Version
No HTML 3.02
Browser support (more…)
IE8+ FF1+ SA3.1+ OP9.2+ CH2+
Full Full Full Full Full

Syntax

disabled="disabled"

Description

The disabled attribute stops the user from interacting with specific options in the select list. When using the up and down arrow keys, users will simply skip over any disabled options; nor can they click on disabled options with the mouse.

The most likely application for this attribute is to disable certain choices in the list until some other condition has been met (until a checkbox is checked, for example, which widens the potential choices the user may make). At this point, JavaScript would be required to removed the "disabled" values, making those options selectable. Figure 1 shows the effect of disabling specific option elements.

Figure 1. A select list in which two options disabled A select list with two options disabled

Example

The disabled attribute stops the "Cabbage" and "Lettuce" option elements from being used:
<form>
  <label for="favoritefood">Favorite food</label>
  <select name="favoritefood" id="favoritefood">
    <option>Cheese</option>
    <option>Egg</option>
    <option disabled="disabled">Cabbage</option>
    <option disabled="disabled">Lettuce</option>
    ⋮
  </select>
</form>

Value

The only value that disabled can take "disabled".

Compatibility

Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 3.0 3.5 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
None None None Full Full Full Full Full Full None None Full Full Full Full Full Full

This attribute is poorly supported and should not be relied upon.

User-contributed notes

There are no comments yet.

Related Products