I thought there would be a method or property called isfocused. But apparently not.
By in focus I mean they've tabbed to it using the keyboard and at this point pressing space would check the box.
Create an event handler that is wired to the onfocus event. When it's called, set a global var to remember that it's got the focus. Write another one on the onblur event which clears the variable.
There is a onfocus event that fires when an element receives focus.
You might have to just hook into the onfocus and onblur events for the checkbox to keep track of when it gets and loses focus.
Here's an example of the basics of an implementation that might help you. Note: the output stuff is just for demonstration purposes and not part of the actual solution.
©2020 All rights reserved.