input on enter key press code example
Example 1: javascript submit form when enter key pressed
document.getElementById("myInputID").addEventListener("keyup", function(event) {
if (event.keyCode === 13) {
document.getElementById("myFormID").submit();
return false;
}
});
Example 2: javascript key pressed enter
$('.container').on('keydown', 'input', function(e) {
if (e.keyCode === 13) {
e.preventDefault();
e.stopImmediatePropagation();
}
});
Example 3: input keyboard enter type
<input enterkeyhint="search">