/html-dom /Basic
GitHub 4932★

Detect if an element is focused

Assume that ele represents the element that you want to check if it has the focus currently:

const hasFocus = ele === document.activeElement;
Follow me on and to get more useful contents.