Disable the selection of dropdown list box items after page loaded - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Select

Description

Disable the selection of dropdown list box items after page loaded

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
window.onload = function () {// w  w  w. j a v  a  2 s  .  c om
    document.getElementById('dropdown2').disabled=true;
}

      </script> 
   </head> 
   <body> 
      <select id="dropdown2">
         <option>My Option</option>
         <option>My Option</option>
         <option>My Option</option>
         <option>My Option</option>
      </select>  
   </body>
</html>

Related Tutorials