Prevent form submit from enter key pressed in jQuery.

How we disable form submit when enter key is pressed??

You have a form where in an input text box. If you enter a string and press enter then time your form will be submitting.

If you only want to disable the Enter key to submit the form, then you need to let its keypress event handler return false when the keycode matches 13.

Preventing form submission when Enter key is pressed will solved by following trick.

<form onkeypress="return event.keyCode != 13;">

I hope it will work for you. 🙂

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s