Organizational Research By

Surprising Reserch Topic

jquery keypress ctrlc or some combo like that


jquery keypress ctrlc or some combo like that  using -'jquery,javascript-events,keypress,keydown'

I'm trying to create shortcuts on the website i'm making. I know I can do it this way:

if(e.which == 17) isCtrl=true;
if(e.which == 83 && isCtrl == true) {
    alert('CTRL+S COMBO WAS PRESSED!')
    //run code for CTRL+S -- ie, save!
    e.preventDefault();
}


But the example below is easier and less code, but it's not a combo keypress event:

$(document).keypress("c",function() {
  alert("Just C was pressed..");
});


So I wanna know if using this second example if I could do something like:

$(document).keypress("ctrl+c",function() {
  alert("Ctrl+C was pressed!!");
});


is this possible? i've tried it and it didn't work, what am i doing wrong.
    

asked Sep 9, 2015 by OctHLGT
0 votes
12 views



Related Hot Questions

6 Answers

0 votes
NULL
answered Sep 9, 2015 by ReinaANBvhwd
0 votes
NULL
answered Sep 9, 2015 by Sha4777
0 votes
NULL
answered Sep 9, 2015 by AdalbertoACB
0 votes
NULL
answered Sep 9, 2015 by LinShrader
0 votes
NULL
answered Sep 9, 2015 by DolCross
0 votes
NULL
answered Sep 9, 2015 by CCPRonicqlmk

...