Using jQuery, I can test if an input field has focus like so:
if ($("...").is(":focus")) {
...
}
How do I do that without using jQuery?
Using jQuery, I can test if an input field has focus like so:
if ($("...").is(":focus")) {
...
}
How do I do that without using jQuery?
This question was answered here: Javascript detect if input is focused
Taken from the above answer: