17-06-2010

jQuery find input with focus

The fact that you can use CSS pseudo selectors to select elements in jQuery makes it much easier to find the element or input with focus inside a document. You can simply use the :focus pseudo selector. This works on all major browsers except ofcourse IE6.

// selects input that currently has focus:
 
$('input:focus');

Comments:

Your comment:

»

 

[x]