Focus on first input box / field on page load using jquery

This is a very quick tutorial to Focus on first input box / field on page load using jquery, This is useful trick while you want to focus user’s attention on form while doing registration or any other form filling task, it makes easy for users to start filling forms.



Here is the single line of code to add focus on form’s first filed.

$(function(){  
    $("input[type=text]:first").focus();  
});

The above code snippet useful on all kinds of form filling task.