문제

I haven't figured yet how jQuery keybindings work.

I want to trigger a function when CTRL+Z is pressed for example.

These docs from jQuery's site seems to me, to be dealing with ANY keypress. I'm obviously missing something.

Thanks!

도움이 되었습니까?

해결책

This is how you detect a Ctrl+Z:

$(document).keydown(function(e){
      if( e.which === 90 && e.ctrlKey){
         alert("yahoo!");
         // Do your stuff
      }
}); 

jQuery has some built in stuff as well:

Demo: http://jsfiddle.net/

Article: http://www.mkyong.com/jquery/how-to-detect-copy-paste-and-cut-behavior-with-jquery/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top