开发者

Can I run a call just _after_ an element is focused?

From what I gather, jQuery's focus() gets called before the element is focused. I believe this is so because the element's border is different when focused, and when I measure it I get the unfocused border size.

Is there a way to run code right after the 开发者_运维技巧element gets focus?


You could run your code in a timeout handler after a tiny delay.

$('.foo').focus(function() {
  var foo = this;
  setTimeout(function() {
    $(foo).whatever();
  }, 1);
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜