Skip to content

Instantly share code, notes, and snippets.

@alexey-kar
Created November 23, 2018 06:44
Show Gist options
  • Save alexey-kar/136356d686a0939eb58f7ec5b63bac59 to your computer and use it in GitHub Desktop.
Save alexey-kar/136356d686a0939eb58f7ec5b63bac59 to your computer and use it in GitHub Desktop.
Jquery Программное сочетание клавиш / Jquery trigger shortcut
// 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