Answers for "How to find out what character key is pressed?#key#keyCode#code"

0

How to find out what character key is pressed?#key#keyCode#code

<table>
<tr><td>Key:</td><td id="key"></td></tr>
<tr><td>Key Code:</td><td id="keyCode"></td></tr>
<tr><td>Event Code:</td><td id="eventCode"></td></tr>
</table>
<script type="text/javascript">
window.addEventListener("keydown", function (e) {
  //tested in IE/Chrome/Firefox
  document.getElementById("key").innerHTML = e.key;
  document.getElementById("keyCode").innerHTML = e.keyCode;
  document.getElementById("eventCode").innerHTML = e.code;
})
</script>
Posted by: Guest on May-24-2021

Code answers related to "How to find out what character key is pressed?#key#keyCode#code"

Code answers related to "Javascript"

Browse Popular Code Answers by Language