开发者

How to determine if a field has focus?

开发者 https://www.devze.com 2023-02-14 13:04 出处:网络
Very similar to How do I find out which DOM element has the focus? except that I\'m not trying find the field that has focus, I just 开发者_运维问答need to know if a particular one already has focus.

Very similar to How do I find out which DOM element has the focus? except that I'm not trying find the field that has focus, I just 开发者_运维问答need to know if a particular one already has focus. Is that possible?


You can try

$("input#id").is(":focus")

Edit: You should read this post if you plan to use it on older browsers. http://forum.jquery.com/topic/is-the-focus-selector-valid


You can do this rather simply with jQuery: $(el).is(":focus")

0

精彩评论

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