Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3601106
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:34:47+00:00 2026-05-18T20:34:47+00:00

Users don’t like the fact that the Enter key submits the page. So I

  • 0

Users don’t like the fact that the Enter key submits the page. So I am tasked with preventing the submission and changing the Enter key to a Tab to the next field.

I have tried many javascript snippets found on the net but none have worked so far. The only one that has even come close to having an effect was e.preventDefault() of the jQuery API, which stops the submit, but nothing I have tried emulates the tab behavior.

e.returnValue = false;
e.cancel = true;

Page still submits with the above in the keydown event handler. Same effect with return false in the keydown event handler. The handler is firing, tested by putting a breakpoint in it with firebug.

This needs to work with both IE and Firefox.

Don’t say “don’t do this”.
1) I’m already convinced that I shouldn’t do it, but it’s not a choice that is mine, so the discussion is mute.
2) It would be an answer to the question “Should I do this?”, which is not the question that I am asking.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T20:34:48+00:00Added an answer on May 18, 2026 at 8:34 pm

    This just feels icky, but you could use event.preventDefault as you mentioned and then call focus() on the next closest input:

    Here’s a simple example:

    $("input").bind("keydown", function(event) {
        if (event.which === 13) {
            event.stopPropagation();
            event.preventDefault();
            $(this).next("input").focus();
        }
    });
    

    Example: http://jsfiddle.net/andrewwhitaker/Txg65/

    Update: If you have elements in between your inputs, using plain next() will not work. Instead, use nextAll():

    $("input").bind("keydown", function(event) {
        if (event.which === 13) {
            event.stopPropagation();
            event.preventDefault();
            $(this).nextAll("input").eq(0).focus();
        }
    });
    

    http://jsfiddle.net/andrewwhitaker/GRtQY/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Users don't like the fact that the Enter key submits the page. So I
I have some pages that I don't want users to be able to access
I've noticed that a lot of sites don't bother anymore with work-arounds so users
I'd like to set up a portal where users don't cooperate but they are
I want to ensure that the websites users don't mess up the primary data
I need to make sure users don't go to the download page unless they
I am writing an ASP.Net MVC application that uses NTLM authentication, so users don't
I have a feature of my application which depends on alternate-click. Windows users don't
I have my users DOB as a string (don't ask), how can I reliably
i don't think im understanding this correctly, but how do i give users a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.