-1

Im working with jquery validation, but if the all element is valid then i press enter, the form is submit, i want to submit form ONLY via submit button not with enter key, how to fix that?

Abu Ayyub
  • 401
  • 4
  • 14

1 Answers1

0

Enter key is the keydown number 13. You should use the following code.

$(document).ready(function() {
  $('input').keydown(function(event){
    if(event.keyCode == 13) {
      event.preventDefault();
      return false;
    }
  });
});