OptionGroup disabled attribute

Definition and Usage

disabled Sets or returns whether the option group is disabled.

Disabled elements are not available and cannot be clicked. By default, disabled elements are usually displayed in gray in the browser.

See also:

HTML Reference Manual:HTML <optgroup> disabled Attribute

HTML Reference Manual:HTML <optgroup> Tag

Instance

Example 1

Disable the option group:

document.getElementById("myOptgroup").disabled = true;

Try it yourself

Example 2

Check if the option group is disabled:

var x = document.getElementById("myOptgroup").disabled;

Try it yourself

Syntax

Return the disabled attribute:

optiongroupObject.disabled

Set the disabled attribute:

optiongroupObject.disabled = true|false

Attribute value

Value Description
true|false

Specifies whether the option group should be disabled.

  • true - The option group is disabled
  • false - Default. The option group is not disabled

Technical Details

Return Value: Boolean value, returns true if the option group is disabled; otherwise returns false.

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support