tags:

views:

19

answers:

2

Hi,

How do I select/highlight the default value inside the input on focus?

thanks

+1  A: 

Take a look at this article:

<input type="text" id="txtInput" />

and then:

$('#txtInput').click(function() { 
    var textbox = $(this);
    textbox.focus();
    textbox.select();
});
Darin Dimitrov
+1  A: 
$('input').focus(function() {
  $(this).select();
});
Aaron Hathaway