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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:31:43+00:00 2026-05-17T23:31:43+00:00

I have two buttons one with id=enterToSubmit and other with id=clickToSubmit. When a user

  • 0

I have two buttons one with id=enterToSubmit and other with id=clickToSubmit. When a user hit the enterkey, I want “enterToSubmit” button to submit form
not the “clickToSubmit” button.

On the same page, I have a textbox id=title, and on Page Load I hide “enterToSubmit ” button, until user enters something in the textbox, then users can hit Enter key to submit form.

How do preven “clickToSubmit” button to submit when users press Enter key?

  • 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-17T23:31:44+00:00Added an answer on May 17, 2026 at 11:31 pm

    Unfortunately you can’t change the ‘default’ submit button in HTML, it’s always the first input/button with type submit/image.

    Whilst you can attempt to catch Enter keypress events manually it is highly unreliable to do so, since Enter isn’t always supposed to submit a form, depending on (a) what type of element is focused, (b) whether shift/ctrl+enter is used, (c) what other elements are in the form and (d) what browser it is. If you miss a case you will get accidental default-submissions; if you hit a case you shouldn’t, you’ll get accidental enter-submissions.

    So it is in general better, when you want to control the default submission action of a form, to put an extra button in as the first submit button in the form. If you don’t want this button to be displayed, you can position it with a large negative left value to push it off the side of the page. (This is a bit ugly, but hiding it via display or visibility will stop it working in some browsers.)

    So perhaps you could ‘hide’ the enter-to-submit button not by making it disappear but by pushing it off the page where it can’t be seen, and then catching the click event on it to return false and stop the form submission.

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

Sidebar

Related Questions

I have two submit buttons in one form. I want to call different actions
I am trying to have two submit buttons in my form - one accepts
I have two submit buttons and one form. How do I check what submit
I have two submit buttons in one form and both the submit are linked
In Application i have two buttons in which one button is used as a
I have two radio buttons next to each other, and even though each one
I have a page with two buttons, one Button opens a popup window with
I have a form that has two buttons on it, one yes, one no,
I have two buttons, one of class button white and another one of class
I have two buttons on form, one of the buttons contain currency code (EUR,

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.