Prevent Enter From Submitting Form
- Prevent Enter From Submitting Form
Using a form with several text fields and a submit button? Want to force the user to use the submit button instead of the ENTER key? Disable the ENTER Key!
Instead of using
<input type="submit" value="Submit">
Use this instead
Sometimes writing an OnClick doesn't work. Try this instead.
In the body of the page write this
The function KeyPress() should look like this. This will disable the enter key on that page.
if (window.event.keyCode == 13)
javascrtipt no enter disable enter key force submit