Answers for "prevent enter from submitting form"

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
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
1

how to stop form from submitting on enter

<form ... onkeydown="return event.key != 'Enter';">
Posted by: Guest on November-26-2020
0

prevent form submission on enter key

<form action="...">
  <!-- Prevent implicit submission of the form -->
  <button type="submit" disabled style="display: none" aria-hidden="true"></button>

  <!-- ... -->

  <button type="submit">Submit</button>
</form>
Posted by: Guest on May-08-2021

Code answers related to "prevent enter from submitting form"

Browse Popular Code Answers by Language