Search
 
SCRIPT & CODE EXAMPLE
 

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

js enter key event listener

document.getElementById("yourElementId").addEventListener("keypress", function (event) {
    if (event.key === "Enter") {
       // the code you want to run
    }
})
Comment

javascript key pressed enter

$('.container').on('keydown', 'input', function(e) {
  if (e.keyCode === 13) {
    e.preventDefault();
  	e.stopImmediatePropagation();
    //Do your stuff...
  }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: react native length of object 
Javascript :: javascript array of cumulative sum 
Javascript :: jquery get iframe content 
Javascript :: js sleep sync 
Javascript :: error java.io.filenotfoundexception tessdata/eng.traineddata 
Javascript :: canvas font colour 
Javascript :: nexe error: vcbuild.bat nosign release x64 exited with code: 1 
Javascript :: jquery scroll into view 
Javascript :: js get string before character 
Javascript :: javascript change page title 
Javascript :: multer file type validation 
Javascript :: installation of material ui core using npm 
Javascript :: js number to hex 
Javascript :: jquery get base url 
Javascript :: select2 disable search 
Javascript :: npm ERR! code ENOENT npm ERR! syscall rename 
Javascript :: react allow only numbers in input 
Javascript :: react-native release build 
Javascript :: get pods on specific node 
Javascript :: javascript random boolean 
Javascript :: react router external link 
Javascript :: react native open email client 
Javascript :: how to hack the chrome dinosaur game 
Javascript :: react native margin 
Javascript :: js create element 
Javascript :: nodejs put array in file 
Javascript :: how to clear pod cache in react native 
Javascript :: window is not define nextjs 
Javascript :: write html is jsx extension for vscode 
Javascript :: javascript max safe integer 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =