Click here to Skip to main content
13,408,880 members (45,673 online)
Rate this:
Please Sign up or sign in to vote.
See more:
My webform has 3 textboxes.
I want to move through textboxes by pressing Enter Key.
using or javascript or anything else.

I didn't find anything in google that works.

Please help
Posted 18-Jan-13 7:05am
Updated 18-Jan-13 7:08am
adriancs 25-Nov-14 8:35am
You are too lazy to even search in google.
You should not be helped.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Find your solution below.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TextBoxEnterbox.aspx.cs" Inherits="TextBoxEnterbox" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">

<head runat="server">

<script type="text/javascript" src=""></script>


<script type="text/javascript">

$(document).ready(function() {

// Setting focus on first textbox


// binding keydown event to textbox

$('input:text').bind('keydown', function(e) {

// detecting keycode returned from keydown and comparing if its equal to 13 (enter key code)

if (e.keyCode == 13) {

// by default if you hit enter key while on textbox so below code will prevent that default behaviour


// getting next index by getting current index and incrementing it by 1 to go to next textbox

var nextIndex = $('input:text').index(this) + 1;

// getting total number of textboxes on the page to detect how far we need to go

var maxIndex = $('input:text').length;

// check to see if next index is still smaller then max index

if (nextIndex < maxIndex) {

// setting index to next textbox using CSS3 selector of nth child

$('input:text:eq(' + nextIndex+')').focus();








<form id="form1" runat="server">


First Name: <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

Last Name: <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>

Email: <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>

Confirm Email: <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>

<asp:Button ID="btnSubmit" runat="server" Text="Submit" />




Sourav Sarkar-SS2 18-Jan-13 13:50pm
Thank you so much, sir!
I am Really grateful to you.
You are just great.
Awesome work.
Thanks you once again
amitkumar5734 23-Sep-14 5:58am
sir in this question we have only textboxses just provide me a solution if we have some button or radio button then what i have to do
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Adam R Harris 18-Jan-13 14:49pm
You win the prize for most ungrateful Code Project user.
Had you actually clicked through the link and read it, it would have given you basically the same solution.
It is users like you that bring down the quality of this site, once again if you open the link i posted and read that thread you will see that it is essentially the same solution that was posted in Solution 2.

You're an ass and i will make sure i skip over any future questions you have.
Adam R Harris 23-Jan-13 10:29am
Thank you for proving my point.
adriancs 25-Nov-14 8:36am
He is too lazy to search in google and yet lie.
He should not be helped.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01-2016 | 2.8.180212.1 | Last Updated 18 Jan 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100