Question

I want to check whether the current focus is in editor or not at the compose screen in Thunderbird.

I tried below code but it is giving me null instead of object of that focused element.

XUL

<editor type="content-primary" id="content-frame" src="about:blank"
        name="browser.message.body" flex="1" context="msgComposeContext"/>    

JS

alert(document.commandDispatcher.focusedElement);

I want to check whether the current focus is on editor (body area) or not. How can I get the currently focused element?

Was it helpful?

Solution

Okay. I got the answer. You can check using below code.

document.activeElement.id
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top