Answers for "prevent enter key press jquery"

1

jquery avoid enter submit

$(document).ready(function() {
  $(window).keydown(function(event){
    if(event.keyCode == 13) {
      event.preventDefault();
      return false;
    }
  });
});
Posted by: Guest on June-12-2020
0

prevent enter key submitting a form jquery

$('#formid').on('keyup keypress', function(e) {
  var keyCode = e.keyCode || e.which;
  if (keyCode === 13) { 
    e.preventDefault();
    return false;
  }
});
Posted by: Guest on September-14-2021

Browse Popular Code Answers by Language