code_junkie

Best cross-browser method to capture CTRL+S with JQuery?

Nov 10th, 2011
428
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. $(window).keypress(function(event) {
  2. if (!(event.which == 115 && event.ctrlKey) && !(event.which == 19)) return true;
  3. alert("Ctrl-S pressed");
  4. event.preventDefault();
  5. return false;
  6. });
  7.  
  8. shortcut.add("Ctrl+S",function() {
  9. alert("Hi there!");
  10. });
  11.  
  12. $.ctrl('S', function() {
  13. alert("Saved");
  14. });
Add Comment
Please, Sign In to add comment