Advertisement
congdantoancau

Capturing ctrl+z key combination in javascript

Feb 29th, 2020
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var btnUndo = $('#handPre')[0];
  2.  
  3. // https://stackoverflow.com/questions/16006583/capturing-ctrlz-key-combination-in-javascript
  4. function KeyPress(e) {
  5.       var evtobj = window.event? event : e
  6.       if (evtobj.keyCode == 90 && evtobj.ctrlKey)
  7.                 btnUndo.click();
  8. }
  9.  
  10. document.onkeydown = KeyPress;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement