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,073
  • 146
  • 84
  • 117
Aparna
  • 280
  • 1
  • 8