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;
}
});

Share and Enjoy

  • Facebook
  • Twitter
  • Google Plus
  • Live
  • Delicious
  • Digg
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS
  • Instapaper
  • FriendFeed

Comments

  1. Great post, I think website owners should acquire a lot from this website its rattling user genial. So much superb info on here :D.

  2. 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?