How to find the key code for a specific key

Acorn picture Acorn · Oct 29, 2010 · Viewed 47k times · Source

What's the easiest way to find the keycode for a specific key press?

Are there any good online tools that just capture any key event and show the code?

I want to try and find the key codes for special keys on a mobile device with a web browser, so an online tool would be great.

Answer

Bertrand Marron picture Bertrand Marron · Oct 29, 2010

    $(function () {
      $(document).keyup(function (e) {
         console.log(e.keyCode);
      });
    });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

Here's your online tool.