JavaScript -Test, wenn Element Fokus hat
var myElement = document.getElementById('myID');
if(myElement === document.activeElement){
//myElement Has Focus
}
Grepper
var myElement = document.getElementById('myID');
if(myElement === document.activeElement){
//myElement Has Focus
}
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 */