Jquery .select() on focus event - Javascript jQuery

Javascript examples for jQuery:Selector

Description

Jquery .select() on focus event

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-2.0.2.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/*from ww  w .ja  va 2s  . com*/
$('#selectMe').on("click", function() {
    this.select();
});
$('#focusHim').click( function() {
    $('#selectMe').focus();
});
    });

      </script> 
 </head> 
 <body> 
  <input id="selectMe" value="123"> 
  <input type="button" id="focusHim" value="Im working fine">  
 </body>
</html>

Related Tutorials