← 返回首页
HTMLOptGroupElement: disabled property - Web APIs | MDN

HTMLOptGroupElement: disabled property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

The disabled property of the HTMLOptGroupElement interface is a boolean value that reflects the <optgroup> element's disabled attribute, which indicates whether the control is disabled.

When disabled, the <option> element descendants of the <optgroup> element are unusable, un-clickable, and unselectable. These disabled <option>s will match the :disabled selector, even if their disabled property value is false.

In this article

Value

A boolean value.

Examples

js
const optionGroup = document.getElementById("groupB"); console.log(optionGroup.disabled); optionGroup.disabled = true;

Specifications

Specification
HTML
# dom-optgroup-disabled

Browser compatibility

Enable JavaScript to view this browser compatibility table.

See also