Detecting enter key pressed in JavaScript
Sometimes I want to detect the Enter key press event in JavaScript. Vanilla JS // Listen for the enter key press. document.body.addEventListener('keyup', function (e) { if (e.keyCode == 13) { // Simulate clicking on the submit button. submi...
May 30, 20162 min read736