Created
November 23, 2018 06:44
-
-
Save alexey-kar/136356d686a0939eb58f7ec5b63bac59 to your computer and use it in GitHub Desktop.
Jquery Программное сочетание клавиш / Jquery trigger shortcut
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// variant 1. Press Ctrl+W | |
var e = jQuery.Event("keypress"); | |
e.which = 'w'.charCodeAt(); // # Some key code value | |
e.ctrlKey = true; | |
$(document).trigger(e); | |
// variant 2. Press Ctrl+W | |
$.event.trigger({ type : 'keypress', which : 'w'.charCodeAt(), ctrlKey: true }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment