0

My situation is that I want to use input text but need the enter key disabled. To submit the form they must click on the submit button.

Is there a way to disable the enter so it doesn't submit?

Thank you

malanno
  • 95
  • 7

1 Answers1

1

On your submit button, bind the following code:

$('input').on('keydown', function(event) {
   var x = event.which;
   if (x === 13) {
       event.preventDefault();
   }
});
Pang
  • 9,564
  • 146
  • 81
  • 122
Aparna
  • 255
  • 1
  • 8