HTML | DOM Select disabled Property
The DOM Select disabled Property in HTML DOM is used to set or return whether a drop-down list should be disabled. A disabled element is un-clickable or unusable and is usually rendered grey color by default in Browser. This Property is used to reflect the HTML disabled attribute.
Syntax:
- It returns the disabled property.
selectObject.disabled
- It is used to set the disabled property.
selectObject.disabled = true|false
Property Values:
- true: It specify that the drop-down list would be disabled.
- false: It specify that the drop-down list would not be disabled.
Return Value: It returns a boolean value which represents that the dropdown list would be disabled or not.
Example: This Example returns a disabled Property,
<!DOCTYPE html> <html> <head> <title> Select disabled Property in HTML </title> <style> h1 { color: green; } h2 { font-family: Impact; } body { text-align: center; } </style> </head> <body> <h1> GeeksforGeeks </h1> <h2> Select disabled Property </h2> <select name="Courses Titles" id="myCourses" disabled> <option value="C++">c++</option> <option value="Placement">Placement</option> <option value="Java">Java</option> <option value="Python">Python</option> </select> <p> To return a disabled course from the dropdown list, double-click the "Select" button. </p> <button ondblclick="My_list()"> Select </button> <p id="sudo" style="font-size:24px; color:green"> </p> <script> function My_list() { var g = document.getElementById( "myCourses").disabled; document.getElementById("sudo").innerHTML = g; } </script> </body> </html> |
Output:
Before Clicking On Button:

After Clickcing On Button:

Example-2: This Example sets the disabled Property.
<!DOCTYPE html> <html> <head> <title> Select disabled Property in HTML </title> <style> h1 { color: green; } h2 { font-family: Impact; } body { text-align: center; } </style> </head> <body> <h1> GeeksforGeeks </h1> <h2> Select disabled Property </h2> <select name="Courses Titles" id="myCourses" disabled> <option value="C++">c++</option> <option value="Placement">Placement</option> <option value="Java">Java</option> <option value="Python">Python</option> </select> <p> To set a disabled course from the dropdown list, double-click the "Select" button. </p> <button ondblclick="My_list()"> Select </button> <p id="sudo" style="font-size:24px; color:green"> </p> <script> function My_list() { var g = document.getElementById( "myCourses").disabled = "false"; document.getElementById("sudo").innerHTML = g; } </script> </body> </html> |
Output:
Before Clicking On Button:

After Clicking On Button:

Supported Browsers:
- Google Chrome
- Mozilla Firefox
- Edge
- Opera
- Safari
Recommended Posts:
- HTML <select> disabled Attribute
- HTML | DOM Button disabled Property
- HTML | DOM Input URL disabled Property
- HTML | DOM Option disabled Property
- HTML | DOM Textarea disabled Property
- HTML | DOM Link disabled Property
- HTML | DOM Fieldset disabled Property
- HTML | DOM Input Color disabled Property
- HTML | DOM Input Checkbox disabled Property
- HTML | DOM Input Text disabled Property
- HTML | DOM Input FileUpload disabled Property
- HTML | DOM Input Date disabled Property
- HTML | DOM Input Range disabled Property
- HTML | DOM Input Password disabled Property
- HTML | DOM Input Week 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.



