English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Disabled属性是布尔属性,如果存在,它指定应该禁用一个选项组,禁用的选项组不可使用且不可单击。
一个被禁用的选项组:
<!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 and see ‹/›
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 cannot be used and cannot be clicked.
Can set the Disabled property to prevent the user from selecting an option group until other conditions are met (such as, checking a checkbox, etc.). Then, JavaScript is needed to remove the disabled values and make the option group selectable.
None.
In XHTML, attribute shorthand is prohibited, the disabled attribute must be defined as <optgroup disabled="disabled">.
<optgroup disabled>HTML <optgroup> Tag