HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Option Object : Disable the third option (index 2) in a drop-down list
The disabled property sets or returns whether an option in a drop-down list should be disabled, or not.
A disabled element is unusable and un-clickable. Disabled elements are usually rendered in gray by default in browsers.
Property | |||||
---|---|---|---|---|---|
disabled | Yes | Yes | Yes | Yes | Yes |
Return the disabled property:
Set the disabled property:
Value | Description |
---|---|
true|false |
Specifies whether an option in a drop-down list should be disabled or not.
|
Return Value: | A Boolean, returns true if the option is disabled, otherwise it returns false |
---|
Find out if the second option (index 1) in a drop-down list is disabled or not:
var x = document.getElementById("pets").options[1].disabled;
HTML reference: HTML <option> disabled attribute
❮ Option Object