How do I tell what element has the focus on page load? 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.
精彩评论