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

  • Home
  • SEARCH
  • 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 8336955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:09:00+00:00 2026-06-09T04:09:00+00:00

How can I submit a form using Enter key. without having a submit button?

  • 0

How can I submit a form using Enter key. without having a submit button?

I tested the below code but it does not working.

$("input").bind("keydown", function(event) {
   console.log('came');
   var keycode = (event.keyCode ? event.keyCode : (event.which ? event.which : event.charCode));
   if (keycode == 13) { // keycode for enter key
     document.getElementById('submitButton').click();
     // $('#frmAddPurchaseord').submit();
     return false;
     } else  {
     return true;
     }
    }); 
 <form name="frmAddPurchaseord" id="frmAddPurchaseord" action="" method="post">
   //Submit button
  <input id="submitButton" type="image" name="submit"  src="<?=$gCommonImagePath?>btn_save.png" />
 </form>

Please suggest me!

  • 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-06-09T04:09:01+00:00Added an answer on June 9, 2026 at 4:09 am

    Keep it simple:

    <form name="frmAddPurchaseord" id="frmAddPurchaseord" action="" method="post">
          <input type="text" name="name" onkeypress="if(event.keyCode==13) {this.submit();}" />
    </form>
    

    Using jquery:

    $("input").keypress(function(event) {
      if (event.which == 13) {
            event.preventDefault();
            $("#frmAddPurchaseord").submit();
        }
    });
    

    Hope this helps.

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

Sidebar

Related Questions

I am newbie to jQuery, can someone explain what this code does: $(#currency form).submit(function(e)
I'd like to submit a form using GET but without passing the value of
I am using a button to submit a form, not a submit button. However,
I'm trying to prevent double submission using the enter key on my form, but
I'm using jQuery's .preventDefault() to prevent form submit when users clicks the [ENTER] key.
I know that a submit button in HTML can submit a form which opens
How can I submit jQuery form object (not ajax)? I try form.submit() and it
Can anyone tell me why the following code fails to submit the form into
I'm trying to submit a form entry with an uploaded file, but I can't
Is there a way I can tell how many times a form submit button

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.