Select all string and focus when document is ready - Javascript jQuery

Javascript examples for jQuery:Selector

Description

Select all string and focus when document is ready

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.6.3.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){/*from   ww w .j  a v a2 s . com*/
$(document).ready(function () {
  $("#myTextBox").focus().select();
});
    });

      </script> 
   </head> 
   <body>
       Name: 
      <input id="myTextBox" type="text" class="myText" value="First Name">  
   </body>
</html>

Related Tutorials