Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript key event

// Add event listener on keydown
document.addEventListener('keydown', (event) => {
  var name = event.key;
  var code = event.code;
  // Alert the key name and key code on keydown
  alert(`Key pressed ${name} 
 Key code value: ${code}`);
}, false);
Source by www.section.io #
 
PREVIOUS NEXT
Tagged: #javascript #key #event
ADD COMMENT
Topic
Name
9+2 =