set prop('selectedIndex') in Firefox - Javascript jQuery

Javascript examples for jQuery:Selector

Description

set prop('selectedIndex') in Firefox

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.9.1.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){//from   w ww .  j a  va2  s  .  c  om
$('select').find('option').first().next().prop('selected','selected');
console.log($('select').prop('selectedIndex'));
    });

      </script> 
 </head> 
 <body> 
  <select> <option value="1">1</option> <option value="2">2</option> </select>  
 </body>
</html>

Related Tutorials