Skip to content

Instantly share code, notes, and snippets.

@hktonylee
Last active December 13, 2015 23:39
Show Gist options
  • Save hktonylee/4993179 to your computer and use it in GitHub Desktop.
Save hktonylee/4993179 to your computer and use it in GitHub Desktop.
Use Javascript to fire DOM mouse click events
function fireEvent(obj,evt) {
var evObj = document.createEvent('MouseEvents');
evObj.initEvent(evt, true, false );
obj.dispatchEvent(evObj);
}
// fireEvent(document.getElementById('someID'), 'click');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment