It's a common practice on many sites to put the focus on the first input. But, in many cases, this first input has already been filled in, either by the browser's auto-complete, failed form validation, or other.

Why not place that focus on the first empty input. This is accomplished with one line of jQuery.

$('input[value=""]').first().focus();

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *