Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Triggering Ctrl S or Ctrl P via a button

Ok now I am aware that you can listen to keypresses (keydowns keyups etc...) but I would like to TRIGGER a keypress. Like as if the user presses CTRL+S to save.

Short question is, is it possible to use Jquery to trigger 2 key presses at the same time? I have been trying to look this up but all the stuff I found was talking about capturing key presses and not triggering them especially 2 key presses at the same time.

Any ideas how this can be accomplished? If you could lead me to the right track it would be much appreciated.

like image 448
Alcatraz Avatar asked Dec 17 '22 11:12

Alcatraz


1 Answers

If you want to trigger your own handler code, you should just put that code in a separate function and call the function normally.

If you want to trigger the browser's default functionality, you should give up; that is impossible for security reasons. (Although you may be interested in window.print())

like image 144
SLaks Avatar answered Dec 27 '22 18:12

SLaks