Answers for "how to disable enter key in form submit"

6

html disable enter submit

//per form disabling
<form ... onkeydown="return event.key != 'Enter';">
 
  
//or with jquery  
<script>
 $(document).on("keydown", "form", function(event) { 
    return event.key != "Enter";
});
 </script>
Posted by: Guest on August-26-2020
0

jquery disable enter key submit

$(document).on('keyup keypress', 'input', function(e) {
  if(e.which == 13) {
    e.preventDefault();
    return false;
  }
});
Posted by: Guest on April-30-2020
0

deactivate enter key button

/**
 * Disable the enter key from submitting the form for all forms all fields
 */
<script type="text/javascript">
    jQuery(function($){
        $("form").keypress(function(e) {
          //Enter key
          if (e.which == 13) {
            return false;
          }
        });        
	});
</script>
Posted by: Guest on September-03-2021

Code answers related to "how to disable enter key in form submit"

Browse Popular Code Answers by Language