check if textbox is focused jquery
//test if element has focus in jQuery
if ($("#myElementID").is(":focus")) {
//I have the focus
}
//test if element has focus in plain Javascript
var myElement = document.getElementById('myID');
if(myElement === document.activeElement){
//myElement Has Focus
}
0
0
var myElement = document.getElementById('myID');
if(myElement === document.activeElement){
//myElement Has Focus
}
Thank you!
0
0
Are there any code examples left?
New code examples in category Javascript