How can get the id of the focused element of the web page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nayana4u
    New Member
    • Jul 2008
    • 1

    How can get the id of the focused element of the web page

    I want to take the id of the focused element in the page by javascript.
    but with my situation i cant use the onFouse() method of each element to call other javascript element.

    simply without changing the body of the page i want to get the id of focused element.

    how can i do it?
    plz help me all the experts soon!!!!!
  • rnd me
    Recognized Expert Contributor
    • Jun 2007
    • 427

    #2
    it is a property of document:
    Code:
       alert(document.activeElement)
    check out MDC for more info.

    this used to be IE only, until firefox 3 picked it up. so, it won't work in FF2 and perhaps other browsers

    Comment

    Working...