views:

45

answers:

1

If the user begins typing, and the focus happens to not be on the only input control I have on the page, how can I set the focus to be on that input control in order to create a better user experience? There are things that can have the focus, such as if the user tabs to a hyperlink or mouse clicks outside the input.

+1  A: 

Try:

$('body').keydown(function() { $('input').focus(); });
nicerobot