Click here to Skip to main content
12,948,566 members (66,513 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


4 bookmarked
Posted 14 Aug 2013

Tab focus of textbox in ASP.NET using jQuery

, 15 Aug 2013 CPOL
Rate this:
Please Sign up or sign in to vote.
Auto Tab focus to next textbox control in ASP.NET using jQuery.


When user presses the Enter key, the Tab focus of a textbox moves to the next textbox using jQuery in ASP.NET.

Using the Code

Write this code in the Head tag of a webpage:

<script src="Scripts/jquery-1.9.1.js" 
<script type="text/javascript" language="javascript">
$(document).ready(function () 
    $('input:text').bind('keydown', function (e) 
        if (e.keyCode == 13) 
            var nextIndex = $('input:text').index(this) + 1;
            var maxIndex = $('input:text').length;
            if (nextIndex < maxIndex)
                $('input:text:eq(' + nextIndex + ')').focus();


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior)
India India
Musakkhir Sayyed is a Software Engineer working in IT Company. He has been a programmer/Software Developer for past 5 years specializing in .NET/C# development.

You may also be interested in...


Comments and Discussions

GeneralMy vote of 1 Pin
JasonMacD15-Aug-13 6:21
memberJasonMacD15-Aug-13 6:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170524.1 | Last Updated 15 Aug 2013
Article Copyright 2013 by Musakkhir
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid