Disable a textbox by set its disabled attribute - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Text

Description

Disable a textbox by set its disabled attribute

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  ww. j  av  a 2  s  . c  om*/
document.getElementById('freq2').setAttribute('disabled', true);
    }

      </script> 
   </head> 
   <body> 
      <select id="freq2"> 
         <option>Choose an option</option> 
      </select>  
   </body>
</html>

Related Tutorials