English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The disabled attribute of the option element is a boolean attribute. If present, it specifies that an option should be disabled. Disabled options are not available and cannot be clicked.
A dropdown list with a disabled option:
<!DOCTYPE html> <html> <head> <title>HTML: <option disabled attribute</title> - 基础教程网(oldtoolbag.com)</title>/title> </head> <body> <select> <option value="PHP" disabled>PHP</option>/option> <option value="HTML">HTML</option>/option> <option value="C++">C++</option> <option value="GOLANG">GOLANG</option>/option> <option value="JAVA">JAVA</option>/option> </select> </body> </html>Test it out ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the disabled attribute.
Note:Internet Explorer 7 and earlier versions do not support the disabled attribute of the <option> tag.
The disabled attribute is a boolean attribute.
If present, it specifies that an option should be disabled.
Disabled options are not available and cannot be clicked.
The disabled attribute can be set to prevent the user from selecting the option until other conditions are met (such as checking a checkbox, etc.). Then, JavaScript is needed to remove the disabled value and make the option selectable.
None.
In XHTML, attribute shorthand is prohibited, the disabled attribute must be defined as <option disabled="disabled">.
<option disabled>HTML <option> tag