HTML DOM OptionGroup disabled property
Examples
Disable an option-group:
document.getElementById("myOptgroup").disabled=true;
Output:
BMW
Mercedes
Volvo
Saab
Koenigsegg
try it"
Definition and Usage
disabled property sets or returns whether to disable the option group.
Disabled elements are not available, and do not click. By default, the disabled elements typically exhibit gray in your browser.
Browser Support
All major browsers support the disabled attribute.
grammar
Returns disabled properties:
optiongroupObject .disabled
Set the disabled attribute:
optiongroupObject .disabled=true|false
Property Value
值 | 描述 |
---|---|
true|false |
规定选项组是否是禁用的。
|
technical details
return value: | Boolean value that, if the group option is disabled, it returns true, otherwise returns false. |
---|
More examples
Examples
Check that option group is disabled:
var x = document.getElementById("myOptgroup").disabled;
document.getElementById("demo").innerHTML=x;
document.getElementById("demo").innerHTML=x;
x The output is:
true
try it"
related articles
HTML Reference Manual: HTML <optgroup> Disabled Property