Answers for "how to prevent enter key submitting form javascript"

1

js stop form submit on enter

<button type="submit" onclick="submitButtonClick(event)">Submit</button>
<script>
function submitButtonClick(event) {
		event.preventDefault();
		//other stuff you want to do instead...
} 
</script>
Posted by: Guest on July-27-2020
0

prevent form submission on enter key

<form action="...">
  <!-- Prevent implicit submission of the form -->
  <button type="submit" disabled style="display: none" aria-hidden="true"></button>

  <!-- ... -->

  <button type="submit">Submit</button>
</form>
Posted by: Guest on May-08-2021

Code answers related to "how to prevent enter key submitting form javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language