Skip to content

Instantly share code, notes, and snippets.

@stephanbogner
Created July 18, 2017 14:43
Show Gist options
  • Save stephanbogner/e06b4ec743c0bb1357e50747d65f70ce to your computer and use it in GitHub Desktop.
Save stephanbogner/e06b4ec743c0bb1357e50747d65f70ce to your computer and use it in GitHub Desktop.
Get the key code on press
<div id="console">
Press a key to see its key code
</div>
<script>
var cnsl = document.getElementById('console');
document.addEventListener("keyup", function(){
cnsl.innerHTML = event.keyCode;
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment