change select value with jQuery - Javascript jQuery

Javascript examples for jQuery:Selector

Description

change select value with jQuery

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.7.1.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){//from   w w w  . j a v a  2  s . com
$(function() {
    $('[name=typedoc]').val('2');
});
    });

      </script> 
 </head> 
 <body> 
  <select name="typedoc" id="typedoc" size="1"> 
     <option value="1">1</option> 
     <option value="2">2</option> 
     <option value="3">3</option>
  </select>  
 </body>
</html>

Related Tutorials