Check active element in the HTML document using JavaScript
How can I get the active element(focussed textbox or rich text box) from a JavaScript bookmarklet? I开发者_StackOverflow want to change the text of a focussed textbox or rich text box when someone clicked on my bookmarklet. Is it possible?
Just accessing document.activeElement
works in Firefox 3.6, IE 7, Chrome 6 and Safari 4. Untested in anything else.
精彩评论