JavaScript Event KeyCodes.

Key Code Key

Press any key to get the JavaScript event keycode

event.key
key
event.location
location
event.which (deprecated)
which
event.code
code

Usage example (press ctrl+z):


   <script>    
var isCtrl = false;
$(document).keyup(function (e) {
if(e.which == 17) isCtrl=false;
}).keydown(function (e) {
if(e.which == 17) isCtrl=true;
if(e.which == 90 && isCtrl == true) {
$('.js-link-to-save-main-form').trigger('click');
alert('You pressed STR + Z');
return false;
}
});
</script>
This site uses cookies and other tracking technologies to assist with your ability to provide feedback, analyze your use of our products and services, and provide content from third parties.