HTML textbox input, select all text on click - Javascript jQuery

Javascript examples for jQuery:Form Input

Description

HTML textbox input, select all text on click

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.1.4.js"></script> 
  <script type="text/javascript">
    window.onload=function(){//from  www. j a va2s. c  o m
$('input').on('click', function(e) {
   var that = $(this);
  setTimeout(function(){
     that.select();
  }, 100);
});
    }

      </script> 
 </head> 
 <body> 
  <input type="text" readonly value="blah">  
 </body>
</html>

Related Tutorials