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 } });