Check if An Element is Focused

PHOTO EMBED

Fri May 13 2022 17:32:22 GMT+0000 (Coordinated Universal Time)

Saved by @desiboli #javascript

const elem = document.querySelector(' .text-input');

const isFocus = elem == document.activeElemnt;

/* isFocus will be true if elem will have focus, and isFocus will be false if elem will not have focus */
content_copyCOPY

https://dev.to/ikamran/7-killer-javascript-one-liners-that-you-must-know-2lla