Answers for "form submitting on enter key"

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
2

javascript submit form when enter key pressed

//submit form when 'Enter' key is pressed while in myInputID
document.getElementById("myInputID").addEventListener("keyup", function(event) {
    if (event.keyCode === 13) {
    	document.getElementById("myFormID").submit();
		return false;
    }
});
Posted by: Guest on August-02-2019
1

how to stop form from submitting on enter

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

how to send a form when you hit the enter key

use the "submit" feature instead of the "button" feature, I.E.

<input type="submit" value="login" onclick="password(this.password)">
Posted by: Guest on May-13-2021

Code answers related to "form submitting on enter key"

Browse Popular Code Answers by Language