note , if you want to process any keys that they registered with the OS (for example: Alt + Tab ), you CANNOT do this with jQuery.
you need to assign your event to unregistered keys to trigger your event using jQuery.
you can try some kind of code, like a hit, to handle what you need.
var keys = {}; $(document).keydown(function (e) { keys[e.which] = true; }); $(document).keyup(function (e) { delete keys[e.which]; }); if( (keys[91] && keys[68]) || (keys[18] && keys[9]) ) { }
or
use jwerty lib to do this. code example:
jwerty.key('ctrl+shift+P', function () {
and support:
jwerty.key('⌃+⇧+P/⌘+⇧+P', function () {
and there is a simple javaScript
Mousetrap library for handling keyboard shortcuts. Take a look at an example:
Mousetrap.bind('h', function() {
OR
It also supports combinations:
Mousetrap.bind(['ctrl+h', 'ctrl+l'], function(e) {
Hope this will be helpful for you.
source share