HTML <option> disabledAttribute

HTML option 标签参考手册HTML <option> Tag

Examples

A drop-down list with 4 options, one option is disabled:

<select> <option value="volvo" disabled>Volvo</option> <option value="saab">Saab</option> <option value="vw">VW</option> <option value="audi">Audi</option> </select>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the disabled attribute.

Note:Internet Explorer 7 and earlier versions do not support the disabled attribute of the <option> tag.


Definition and Usage

The disabled attribute is a boolean attribute.

The disabled attribute specifies that an option should be disabled.

A disabled option is unusable and un-clickable.

The disabled attribute can be set to keep the user from using the option until some other condition has been met (such as selecting a checkbox). Then, JavaScript can be used to remove the disabled attribute to make the option usable again.


Differences between HTML 4.01 and HTML5

None.


Differences between HTML and XHTML

In XHTML, attribute minimization is forbidden, and the disabled attribute must be defined as <option disabled="disabled">.


Syntax

<option disabled>


HTML option 标签参考手册HTML <option> Tag Other Extensions