OptionGroup disabled Property
Example
Disable an option-group:
document.getElementById("myOptgroup").disabled=true;
Output result:
BMW Mercedes Volvo Saab Koenigsegg
Try it »
Definition and Usage
The disabled property sets or returns whether the option group is disabled.
Disabled elements are unavailable and cannot be clicked. By default, disabled elements are usually rendered in gray in the browser.
Browser support





All major browsers support the disabled attribute.
Syntax
Return the disabled attribute:
optiongroupObject
.disabled
Set the disabled attribute:
optiongroupObject
.disabled=true|false
Attribute values
| Value | Description |
|---|---|
| true|false | Specifies whether the option group is disabled.
|
Technical Details
| Return Value: | A Boolean value: returns true if the option group is disabled, otherwise returns false. |
|---|
More examples
Example
Check whether the option group is disabled:
var x = document.getElementById("myOptgroup").disabled;
document.getElementById("demo").innerHTML=x;
x The output is:
true
Try it »
Related Articles
HTML Reference Manual:HTML
OptionGroup Object