HTML <optgroup> disabledAttributes

HTML optgroup 标签参考手册HTML <optgroup> tag

Example

A disabled option group:

<select>
<optgroup label="German Cars" disabled>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</optgroup>
</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 <optgroup> tag.


Definition and Usage

The disabled attribute is a boolean attribute.

The disabled attribute specifies that an option group should be disabled.

A disabled option group is unusable and un-clickable.

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


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 <optgroup disabled="disabled">.


Syntax

<optgroup disabled>


HTML optgroup 标签参考手册HTML <optgroup> tag Other Extensions