开发者

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.... />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜