To stop Enter key from triggering button click with JavaScript, we set the type attribute of the button to button
.
For instance, we write
<button type="button">click me</button>
to add a button with type attribute button
to stop pressing enter from trigger a button click.