Enable only first option in a Select Box - Javascript jQuery Selector

Javascript examples for jQuery Selector:first

Description

Enable only first option in a Select Box

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-1.5.2.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){//  ww  w . ja  va  2s .co m
$('option').attr('disabled','disabled').eq(0).removeAttr('disabled');
    });

      </script> 
 </head> 
 <body> 
  <select> <option>test</option> <option>test</option> <option>test</option> <option>test</option> </select>  
 </body>
</html>

Related Tutorials