Using jQuery to test if an input has focus
jQuery 1.6+ jQuery added a :focus selector so we no longer need to add it ourselves. Just use $(“..”).is(“:focus”) jQuery 1.5 and below Edit: As times change, we find better methods for testing focus, the new favorite is this gist from Ben Alman: jQuery.expr[‘:’].focus = function( elem ) { return elem === document.activeElement && ( … Read more