jQuery code to disable “Enter” key

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.

Below jQuery code will disable the "Enter" key on the page.

$("#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...