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

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 :: json data from server into html table 
Javascript :: state creation in class components reactjs interview questions 
Javascript :: __filename not defined in mjs files 
Javascript :: passar a página atual na url js net core 
Javascript :: count all items inside 2nd ul using jquery 
Javascript :: how to check in js if element is li or is button 
Javascript :: immediate invoke jquery arrow function 
Javascript :: javascript in array 
Javascript :: how to open same project on different devices vue js 
Javascript :: javascript add character to string at position 
Javascript :: npm search engine 
Javascript :: angular pwa app deploy script 
Javascript :: 5.1.1. Boolean Values¶ 
Javascript :: bjsmasth update 
Javascript :: discord js buttons 
Javascript :: join-an-array-by-a-comma-and-a-space 
Javascript :: callbacks 
Javascript :: path.split is not a function inputRef useForm 
Javascript :: js object to jspn 
Javascript :: javascript debugging methods 
Javascript :: multiple confition checking jasvascript 
Javascript :: js page head comment 
Javascript :: how to use variable key as dictionary key in javascript 
Javascript :: .chartjs-render-monitor 
Javascript :: install vaadin router 
Javascript :: npm generate package-lock.json 
Javascript :: force reload when back_forward is clicked 
Javascript :: no unuseds varsnreactjs 
Javascript :: Ajax Mixed content blocked 
Javascript :: set select2 value from local storage 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =