- How do I restrict submitting a form on Enter?
- How to stop Enter key from submitting the form in JavaScript?
How do I restrict submitting a form on Enter?
Disallow enter key anywhere
on("keydown", "form", function(event) return event. key != "Enter"; );
How to stop Enter key from submitting the form in JavaScript?
To prevent this from happening you can simply stop the form being submitted if the enter key had been pressed. This is done by binding a JQuery event to the input elements of the form and returning false if the key pressed is enter, which has the keyCode value of 13.