English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The disabled attribute is a boolean attribute. If present, it specifies that an option group should be disabled. A disabled option group cannot be used and cannot be clicked.
An example of a disabled option group:
<!DOCTYPE html> <html> <head> <title>HTML: <optgroup> disabled attribute - 基础教程网(oldtoolbag.com)</title> </head> <body> <select> <optgroup label="Swedish Cars"> <option value="volvo">Volvo</option> <option value="saab">Saab</option> </optgroup> <optgroup label="German Cars" disabled> <option value="mercedes">Mercedes</option> <option value="audi">Audi</option> </optgroup> </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 <optgroup> tag.
The Disabled attribute is a boolean attribute.
If present, it specifies that an option group should be disabled.
Disabled option groups are not usable and cannot be clicked.
Can set the Disabled attribute to prevent users from selecting an option group until other conditions are met (such as checking a checkbox, etc.). Then, JavaScript is needed to remove the disabled value and make the option group selectable.
None.
In XHTML, attribute shorthand is prohibited, and the disabled attribute must be defined as <optgroup disabled="disabled">.
<optgroup disabled>HTML <optgroup> tag