| Depr. | Version |
|---|---|
| No | HTML 3.02 |
| IE8+ | FF1+ | SA3.1+ | OP9.2+ | CH2+ |
|---|---|---|---|---|
| Full | Full | Full | Full | Full |
Syntax
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.
Example
Thedisabled
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.
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.