Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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
    }
  });
 
PREVIOUS NEXT
Tagged: #adding #event #enter #key #keypress #javascript
ADD COMMENT
Topic
Name
5+3 =