Using jQuery to test if an input has focus - StackOverflow
jQuery 1.6+
jQuery added a :focus selector so we no longer need to add it ourselves…
|
|
jQuery 1.5 and below
|
|
Any version of jQuery
If you just want to figure out which element has focus, you can use $(document.activeElement)
; If you aren’t sure if the version will be 1.6 or lower, you can add the :focus
selector if it is missing:
|
|