How do you detect which form input has focus using JavaScript or jQuery?
From within a function I want to be able to determine which form input has focus. I\'d like
Otherwise, you could use the onfocus and onblur events.
something like:
and then have something like this in your javascript
if (txtfocus==1)
{
//Whatever code you want to run
}
if (txtfocus==0)
{
//Something else here
}
But that would just be my way of doing it, and it might not be extremely practical if you have, say 10 inputs :)