views:

38

answers:

1

How can I get the active element(focussed textbox or rich text box) from a JavaScript bookmarklet? I want to change the text of a focussed textbox or rich text box when someone clicked on my bookmarklet. Is it possible?

+3  A: 

Just accessing document.activeElement works in Firefox 3.6, IE 7, Chrome 6 and Safari 4. Untested in anything else.

Tim Down
I tested this in IE 8. It works.
Gabriel McAdams