JQuery focus on first input field

JQuery focus on first input field, someone asked me to explain?

Normally, User starts to fill a form,always to select the first  input field on the page.Here,the following little trick will work for any situation automatically on page load. I will explain you, how to focus the first input field in jQuery.

HTML CODE: Copy and paste the following html Code.

<script src="//code.jquery.com/jquery-1.10.2.js"></script>  

<script type="text/javascript">

    $(document).ready(function () {




    <div class="bs-example">


            <h1>JQuery focus </h1>

            <div class="form-group">

                <label for="inputEmail">First Name</label>

                <input type="text" class="form-control" id="inputFirstName" placeholder="First Name">


            <div class="form-group">

                <label for="inputPassword">Last Name</label>

                <input type="text" class="form-control" id="inputLastName" placeholder="Last Name">





Note: User do not forget to register the jQuery plugin on the head section of the page. 

html input focus

Post your comments / questions