2

我有这个代码:

$('#search_user').keyup(function() {
    alert('hello keyup');
}).focus(function() {
    alert('hello focus');
}).blur(function() {
    alert('hello blur');
});

#search_userid一个input领域的。

我关注输入,然后(不模糊)关注浏览器中的地址栏,然后单击 Enter。如果我这样做,我可以看到“警报焦点”。我该如何禁用它?我只想在我集中输入时发出警报,而不是在我用输入刷新页面时发出警报。

浏览器:FF 16

4

1 回答 1

0

I think you're looking for the focusin event. focus fires when losing focus as well as gaining focus.

于 2012-11-02T17:26:27.230 回答