Execute Ctrl+D on button click
问题 I am trying to mimic key press events, for instance Ctrl+D on a button click. It would be great if someone can point me in the right direction on how to achieve the same. 回答1: You're not allowed to do that. Imagine all the havoc I could wreak if I could send CTRL-ALT-DEL at will. 回答2: The code for triggering a custom event (in this instance, Ctrl+d) is as follows: var evt = jQuery.Event("keypress"); evt.keyCode = 100; // d evt.ctrlKey = true; $(document).trigger(evt); NB that, as the other