Setting selected text - Javascript jQuery

Javascript examples for jQuery:Selector

Description

Setting selected text

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.4.2.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){/*from w  w  w.jav a 2 s .c om*/
$('select :selected').text('Mooo');
    });

      </script> 
   </head> 
   <body> 
      <select> 
         <option>Fish</option> 
         <option>Tree</option> 
      </select>  
   </body>
</html>

Related Tutorials