How can i detect a shortcut key, [ in my case [ ctrl + shift + k ] ] in javascript? Like, i have to show a dialog if user presses this key.
Advertisement
Answer
document.onkeydown = keydown; function keydown(evt){ if (!evt) evt = event; if (evt.ctrlKey && evt.altKey && evt.keyCode==115){ //CTRL+ALT+F4 alert("CTRL+ALT+F4"); } else if (evt.shiftKey && evt.keyCode == 9){ //Shif+TAB alert("Shift+TAB"); } }
Ontop of the url Dominic posted will give you the key codes.