How to get input tag of html has focus or not using jquery
keydown event will work for form if input,image etc. tag has focus. but it will not work it focus is on form but not on any tags like input,image etc. How can I solve this. Please help Thanks in advance
$('#title').focusout(function()
{
if($(document.activeElement).is(":focus"))
{
alert('focus');
}
else
{
alert('not focus');
}
});
// this will not work
you can do it by
if ($("#id").is(":focus")) {
alert('focus');
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With