'How to know if an element is blurred or not in Javascript

how do I know if a specific element is blurred or not using an if statement, something like this:

if (elem.isBlurred) {
  // code goes here
}

without using onblur().



Solution 1:[1]

let isBlurred = false;
document.getElementById('element').onclick = funtion() {
isBlurred = !isBlurred;
}
//for each click check with the browser Console (F12), type: isBlurred
/*
if (isBlurred) {
    document.getElementById ('element').classlist.add ("blur");
} else {
    document.getElementById ('element').classlist.remove ("blur");
    }
*/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Webdev