OptionGroup disabledProperty

OptionGroup 对象参考手册OptionGroup Object

Examples

Disable an option-group:

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

Output:

BMW Mercedes Volvo Saab Koenigsegg

Try it yourself »

Definition and Usage

The disabled property sets or returns whether the option group is disabled.

Disabled elements are unavailable and not clickable. By default, disabled elements are usually rendered in gray in the browser.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the disabled property.


Syntax

Return the disabled property:

optiongroupObject.disabled

Set the disabled property:

optiongroupObject.disabled=true|false

Property Values

Value Description
true|false Specifies whether the option group is disabled.
  • true - The option-group is disabled
  • false - Default. The option group is not disabled.

Technical Details

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


More Examples

Example

Check if the option group is disabled:

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

xOutput:

true

Try it yourself »


Related Articles

HTML Reference Manual:HTML <optgroup> disabled Attribute


OptionGroup 对象参考手册OptionGroup Object

Other Extensions