Answers for "on enter key press"

10

adding event on enter key keypress in javascript

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
    }
  });
Posted by: Guest on November-30-2021
8

press button on enter

searchInput.onkeyup = function (e) {
    if (e.key === 'Enter') {
        searchBtn.click();
    }
}
Posted by: Guest on March-11-2021

Code answers related to "Assembly"

Browse Popular Code Answers by Language