Select textbox on focus, deselect on blur
I am try开发者_StackOverflow中文版ing to select a textbox that has my link to this page url in it. I use:
$('.linkTo').focus(function() {
this.select();
});
$('.linkTo').blur(function() {
var input_value = this.value;
this.value = input_value;
});
But it only works the first time, the second time it puts a deselected cursor where I clicked.
Try using foucusin()
and focusout()
http://api.jquery.com/focusin/
http://api.jquery.com/focusout/
Solution edited out from the question:
<input onclick="this.select();" class.... />
精彩评论