Disable “Enter” key on page using jQuery

Today, I got a strange requirement from my client that whenever the "Enter" key is pressed on the page, the page should not be submitted. It should only be submitted when user clicks the submit button using mouse. Well, this was pretty simple and easy with jQuery. I have implemented it in 2 mins and thought of sharing with all my readers. See below jQuery code.

$("#form").keypress(function(e) {
  if (e.which == 13) {
    return false;
  }
});

Feel free to contact me for any help related to jQuery, I will gladly help you.



Responsive Menu
Add more content here...