# elementIsFocused

Canonical: https://www.wiki.jodisand.me/snippets/javascript/elementisfocused/


Checks if the given element is focused.

- Use `Document.activeElement` to determine if the given element is focused.

```js
const elementIsFocused = el => (el === document.activeElement);
```

```js
elementIsFocused(el); // true if the element is focused
```


