Javascript Trigger keypress on mouse click WITHOUT Jquery
问题 I found many results for this on this website but they all seem to use Jquery. I really need to know how to do it without Jquery. What I want is to click a button and have the keystroke for example ALT+N or CTRL+G triggered. Thanks. 回答1: Take a look at the KeyboardEvent constructor. You could use it like this: document.addEventListener('DOMContentLoaded', function () { document.getElementById('alt-n').addEventListener('click', function () { // create a new keyboard event var event = new