OptionGroup disabledProperty
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
![]()
![]()
![]()
![]()
![]()
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.
|
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;
document.getElementById("demo").innerHTML=x;
xOutput:
true
Try it yourself »
Related Articles
HTML Reference Manual:HTML <optgroup> disabled Attribute
Other Extensions
OptionGroup Object