Answers for "js set and check focus on div"

6

javascript test if element has focus

var myElement = document.getElementById('myID');
if(myElement === document.activeElement){
    //myElement Has Focus
}
Posted by: Guest on August-01-2019
0

how to see if the window has focus in js

var focused = document.hasFocus();
Posted by: Guest on November-05-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language