const elem = document.getElementById("input");
elem.addEventListener("keypress", (event)=> {
if (event.keyCode === 13) { // key code of the keybord key
event.preventDefault();
// your code to Run
}
});
document.getElementById("yourElementId").addEventListener("keypress", function (event) {
if (event.key === "Enter") {
// the code you want to run
}
})
$('.container').on('keydown', 'input', function(e) {
if (e.keyCode === 13) {
e.preventDefault();
e.stopImmediatePropagation();
//Do your stuff...
}
});