This is a very simple plugin that provides pretty event names for keyboard events.
The usage is pretty simple, just hook up one of the javascript file shown above and after that you’ll be able to do things like that
$('my-element').on('esc', function() {
// handle Esc button in here
});
$(document).on('enter', function() {
// handle the Enter button
});
$(document).on('ctrl+z', ....);
$(document).on('ctrl-shift-z', ....);
$(document).on('Ctrl+Alt+Delete', function() {
console.log("Good times, good times...");
});
You can specify a key name with or without modifier(s) and your handler will be called only when that specified keyboard combination was triggered.
For key names, you can use any letter from a to z or a number, or any of the following predefined names
Use any letters case you like, works any way
Modifiers can be one of the following
You can join modifiers and key names via spaces, dashes or the + symbol, for example
'ctrl z'
'ctrl-z'
'ctrl+z'
'ctrl+shift-alt z'
Works either way.