开发者

How do I tell what element has the focus on page load? Is this possible?

开发者 https://www.devze.com 2023-01-27 10:21 出处:网络
I\'m looking for some co开发者_高级运维de that I can run in the jQuery(document).ready() function that will let me get the current focused element. Is this possible?

I'm looking for some co开发者_高级运维de that I can run in the jQuery(document).ready() function that will let me get the current focused element. Is this possible?

Cheers, Pete


You can use document.activeElement (also on MSDN), which is roughly the same thing. It will start out as the <body> element, unless the user or a script has moved the focus.

0

精彩评论

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