Disabling an element with Javascript - Javascript DOM

Javascript examples for DOM:Element disabled

Description

Disabling an element with Javascript

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <style>

input[disabled] {
   background: yellow;
}

      </style> 
   </head> 
   <body> 
      <input id="foo" type="text"> 
      <script>
document.getElementById('foo').disabled = true;

      </script>  
   </body>/*ww w. j  a  v a 2  s .c  o m*/
</html>

Related Tutorials