Latest web development tutorials
 

OptionGroup disabled Property

< OptionGroup Object

Example

Disable an option-group:

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

The result will be:

Try it Yourself »

Definition and Usage

The disabled property sets or returns whether an option-group is disabled, or not.

A disabled element is unusable and un-clickable. Disabled elements are usually rendered in gray by default in browsers.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The disabled property is supported in all major browsers.


Syntax

Return the disabled property:

optiongroupObject.disabled

Set the disabled property:

optiongroupObject.disabled=true|false

Property Values

Value Description
true|false Specifies whether an option-group should be disabled or not
  • true - The option-group is disabled
  • false - Default. The option-group is not disabled

Technical Details

Return Value: A Boolean, returns true if the option-group is disabled, otherwise it returns false

More Examples

Example

Find out if an option-group is disabled or not:

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

The result of x will be:

true
Try it Yourself »

Related Pages

HTML reference: HTML <optgroup> disabled attribute


< OptionGroup Object