You can do this pretty easily with or without jQuery (I've included both versions). Just remember to prevent the default behavior with evt.preventDefault() as soon as you know you are interested in the keypress in case the user's browser has a hotkey that matches the one you want to use.
Here is the jQuery version
$(document).keydown(function(evt) {
if (!evt.ctrlKey || !evt.altKey || evt.which < 48 || evt.which >57) {
return;
}
evt.preventDefault();
switch(evt.which) {
case 49:
console.log("hotkey 1");
return;
case 50:
console.log("hotkey 2");
return;
case 51:
console.log("hotkey 3");
return;
case 52:
console.log("hotkey 4");
return;
case 53:
console.log("hotkey 5");
return;
case 54:
console.log("hotkey 6");
return;
case 55:
console.log("hotkey 7");
return;
case 56:
console.log("hotkey 8");
return;
case 57:
console.log("hotkey 9");
return;
case 48:
console.log("hotkey 0");
return;
}
});
Here is the native js version
window.addEventListener("keydown", function (evt) {
if(!evt.altKey || !evt.ctrlKey || evt.which < 48 || evt.which > 57) {
return;
}
evt.preventDefault();
switch(evt.which) {
case 49:
console.log("hotkey 1");
return;
case 50:
console.log("hotkey 2");
return;
case 51:
console.log("hotkey 3");
return;
case 52:
console.log("hotkey 4");
return;
case 53:
console.log("hotkey 5");
return;
case 54:
console.log("hotkey 6");
return;
case 55:
console.log("hotkey 7");
return;
case 56:
console.log("hotkey 8");
return;
case 57:
console.log("hotkey 9");
return;
case 48:
console.log("hotkey 0");
return;
}
}, false);