element.addEventListener("focus", e => console.log("In focus") ); element.addEventListener("blur", e => console.log("Out of focus") );