HTML | DOM OptionGroup disabled Property
The OptionGroup disabled Property in HTML DOM is used to set or return the OptionGroup disabled property. This property checks whether the OptGroup is disabled or not. A disabled <optgroup> element is un-clickable and unusable. It is a boolean attribute.
Syntax:
- It returns a OptionGroup disabled Property.
optiongroupObject.disabled
- It sets the OptionGroup disabled Property.
optiongroupObject.disabled = true|false
Property Values:
- true: It specifies that the OptionGroup is disabled.
- false: It specifies that the OptionGroup is not disabled.
Return Value: It returns a Boolean value which represents an OptionGroup is disbled or not.
Example 1:
<!DOCTYPE html> <html> <head> <title> HTML DOM OptionGroup disabled Property </title> </head> <body style = "text-align:center"> <h1 style = "color: green;">GeeksforGeeks</h1> <h2>HTML DOM optgroup disabled Property</h2> <select> <!--A disabled optgroup--> <optgroup id="GFG" label="Sorting Algorithms" disabled> <option value="merge">Merge sort</option> <option value="quick">Quick sort</option> </optgroup> </select> <br><br> <button onclick="myGeeks()">Try it</button> <p id="sudo"></p> <script> function myGeeks() { var g = document.getElementById("GFG").disabled; document.getElementById("sudo").innerHTML = g; } </script> </body> </html> |
Output:
- Before Clicking on Button:

- After Clicking on Button:

Example 2:
<!DOCTYPE html> <html> <head> <title> HTML DOM OptionGroup disabled Property </title> </head> <body style = "text-align:center"> <h1 style = "color: green;">GeeksforGeeks</h1> <h2>HTML DOM optgroup disabled Property</h2> <select> <!--A disabled optgroup--> <optgroup id="GFG" label="Sorting Algorithms" disabled> <option value="merge">Merge sort</option> <option value="quick">Quick sort</option> </optgroup> </select> <br><br> <button onclick="myGeeks()">Try it</button> <p id="sudo"></p> <script> function myGeeks() { var g = document.getElementById("GFG").disabled = "false"; document.getElementById("sudo").innerHTML = g; } </script> </body> </html> |
Output:
- Before Clicking on Button:

- After Clicking on Button:

Supported Browsers: The browsers supported by HTML DOM OptionGroup disabled Property are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Safari
- Opera
Recommended Posts:
- HTML | DOM OptionGroup label Property
- HTML | DOM Textarea disabled Property
- HTML | DOM Input URL disabled Property
- HTML | DOM Button disabled Property
- HTML | DOM Link disabled Property
- HTML | DOM Fieldset disabled Property
- HTML | DOM Option disabled Property
- HTML | DOM Select disabled Property
- HTML | DOM Input FileUpload disabled Property
- HTML | DOM Input Search disabled Property
- HTML | DOM Input Color disabled Property
- HTML | DOM Input Range disabled Property
- HTML | DOM Input Month disabled Property
- HTML | DOM Input Week disabled Property
- HTML | DOM Input Checkbox disabled Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



