Reputation: 849
I want to disable print for some webpages. How to wireup cross browser hotkeys (Cntrl + P) to a javascript that will be fired whenever hotkeys are pressed?
Upvotes: 32
Views: 38377
Reputation: 23208
You can override by capturing the event.
jQuery(document).bind("keyup keydown", function(e){
if(e.ctrlKey && e.keyCode == 80){
return false;
}
});
Upvotes: 56
Reputation: 4481
Try Keyboard Shortcuts Library.
Instead of just copy pasting it let's havea look at the source and understand how it works.
You can see the source here
Upvotes: 2