Javascript examples for DOM HTML Element:Option
Option disabled Property - Find out if the second option (index 1) in a drop-down list is disabled
<!DOCTYPE html> <html> <body> <select id="pets" size="3"> <option>Cat</option> <option>Dog</option> <option>Horse</option> </select>// w w w .j a v a2s .c om <button onclick="myFunction()">Disable Option</button> <script> function myFunction() { var x = document.getElementById("pets").options[2].disabled; console.log(x); } </script> </body> </html>