on key press event in js code example
Example 1: js when key is pressed
document.addEventListener("keypress", function(event) {
// do stuff
});
Example 2: javascript key pressed enter
$('.container').on('keydown', 'input', function(e) {
if (e.keyCode === 13) {
e.preventDefault();
e.stopImmediatePropagation();
//Do your stuff...
}
});