Skip to content

Instantly share code, notes, and snippets.

@kopiro
Created June 23, 2011 19:22
Show Gist options
  • Save kopiro/1043392 to your computer and use it in GitHub Desktop.
Save kopiro/1043392 to your computer and use it in GitHub Desktop.
Simulate click in any DOM element
HTMLAnchorElement.prototype.click = function (){
var e = document.createEvent("HTMLEvents");
e.initEvent("click",true,true);
return !this.dispatchEvent(e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment