Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM OptionGroup disabled Property

OptionGroup disabled Property

OptionGroup Object Reference OptionGroup Object

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

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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.
  • true - The option-group is disabled
  • false - Default. The option group is not 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 disabled attribute


    OptionGroup Object Reference OptionGroup Object