Answers for "input submit on enter"

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
0

add submit to input

<!-- put this line of code inside of your input -->
 onchange="this.form.submit()

<!-- EXAMPLE -->

      <input type="checkbox" onchange="this.form.submit()">
Posted by: Guest on July-26-2020

Code answers related to "input submit on enter"

Browse Popular Code Answers by Language