submit form when enter key is pressed and onclick event code example
Example: 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;
}
});