Set element attribute via setAttribute method - Javascript DOM

Javascript examples for DOM:Element setAttribute

Description

Set element attribute via setAttribute method

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(){/*from w  w  w. j  av  a 2s  . co  m*/
document.getElementById('freq2').setAttribute('disabled', true);
    }

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

Related Tutorials