0

I've created in Javascript a click event on a <button type="submit"> in a form element. This event is also triggered when I press the enter key. Is this default html behavior?

  • it is default html behaviour for `form` element – GrafiCode Jul 26 '22 at 09:22
  • if you press Enter in the textbox or input field of the following
    it will submit a search query , so if you dont want to trigger that button , change the type of button to `button` like this `
    –  Jul 26 '22 at 09:22
  • Does this answer your question? [Prevent form submission on Enter key press](https://stackoverflow.com/questions/905222/prevent-form-submission-on-enter-key-press) – sm3sher Jul 26 '22 at 09:24

1 Answers1

0

<input type=submit> in the form gets the automatic Enter Key behavior. This is known as an implicit form submission.