Answers for "how to prevent to submit form hitting enter in 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
1

how to stop form from submitting on enter

<form ... onkeydown="return event.key != 'Enter';">
Posted by: Guest on November-26-2020

Code answers related to "how to prevent to submit form hitting enter in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language