JavaScript keyCode with example


JavaScript key events provide properties called ‘keyCode’ and ‘which’ , which you can use to identify which key in keyboard has been pressed by the user. This can be useful in scenarios where you want to perform some action at client side when user interacts through keyboard.

keyCode example

OUTPUT ( try it here ! )

Click here to know the keyCode for each key ( list of codes ).



Submit a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">