Option disabledProperty
Option Object
Example
Example 1
Disable the second option in the dropdown list:
<script>
document.getElementById("mydrop").options[1].disabled=true;
</script>
document.getElementById("mydrop").options[1].disabled=true;
</script>
Output result:
Cat
Dog
Horse
Try it Yourself »
Definition and Usage
The disabled property sets or returns whether an <option> element is disabled by default.
The disabled input element is neither usable nor clickable. The disabled attribute can be set until some other condition is met (such as selecting a checkbox, etc.).
Syntax
Set the disabled property:
element.disabled=true|false
Return the disabled property:
element.disabled
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the disabled property
Option Object Other Extensions