How to trigger event in JavaScript?
Note: the initEvent method is now deprecated. Other answers feature up-to-date and recommended practice. You can use fireEvent on IE 8 or lower, and W3C’s dispatchEvent on most other browsers. To create the event you want to fire, you can use either createEvent or createEventObject depending on the browser. Here is a self-explanatory piece of … Read more