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 8278499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T09:02:17+00:00 2026-06-08T09:02:17+00:00

in my form I have my button like this <button id=mybutton type=submit></button> I am

  • 0

in my form I have my button like this

<button id="mybutton" type="submit"></button>

I am using query submit to submit the form

 $('#mybutton').click(function()
    {
        $('form#myform').submit();
}

It works for most besides when I hit enter it still submits the form totally by passing the click catch.
I changed button type to button

<button id="mybutton" type="button"></button> 

but then it doesn’t do anything when I hit enter.

I heard I could use bind or on but not sure how would that help me in this case. Any help will be appreciated
EDIT

If I change the button type from submit TO button, then it does not do anything when I press enter. then I have to manually click the button. If I leave the type to submit it submits my forms on enter by passing jquery net.

  • 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-08T09:02:21+00:00Added an answer on June 8, 2026 at 9:02 am

    It won’t do anything because it’s an button type.

    But you can try this to “simulate” it and do submit when pressing enter.

    $(document).keypress(function(e) {
       if(e.which == 13) {
           $('form#myform').submit();
       }
    });
    

    Just to add something, some people claims that you will write 2 times the code like this:

    $(document).ready(function(){
    
       $(this).keypress(function(e) {
         if(e.which == 13) {
           $('form#myform').submit();
         }
       });
    
       $('#mybutton').click(function() {
         $('form#myform').submit();
       });  
    
    });​
    

    Isn’t much but I will try to do a short way 🙂

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

Sidebar

Related Questions

I have an HTML form that needs multiple submit buttons, like this: <input type=submit
I have a jQuery function tied to my submit button like this: $(function ()
I have a button element inside a form like this: <form> <input type=text> <button>Test</button>
So I have this hidden form and this 'I like this' button that I
I have a windows form simply like this: 1) a button when clicked will
I have a button which creates form elements on click . My addelement function
I have a form that looks like this: <form name=armdisarmform action=/cameras method=POST> <input type='hidden'
I have a form with a button at the end like this: var simple_form_right
I have a signup button that switches screens for a signup form. I'd like
I have a Switch to window button on my main form that I'd like

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.