javascript test if element has focus
snippet in javascript

javascript test if element has focus

user870

var myElement = document.getElementById('myID');
if(myElement === document.activeElement){
    //myElement Has Focus
}