prevent form submit on enter key using jquery


You can prevent your form to submit on the Enter key event.
Just use the form id in the function.
This is the sample code given below.

$("#form_id").bind("keypress", function(e) {
if (e.keyCode == 13) {
return false;
}
});
Advertisements

2 thoughts on “prevent form submit on enter key using jquery

  1. Thanks for the good writeup. It actually was once a entertainment account it. Glance complicated to far brought agreeable from you! However, how can we keep up a correspondence?

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s