Possible Duplicates:
How to determine which html page element has focus?
How do I find out which Javascript element has focus?
Is there a way to determine which element within the document currently has focus? Ideally without having to walk through every element.
Duplicate:
Long story short:
Some browsers (originally only IE, but Firefox 3 and Safari jumped on the wagon) support the
document.activeElementproperty, which achieves what you want.For older browsers, you need this hack to emulate the property: