SyntaxFix
Write A Post
Hire A Developer
Questions
To trigger an event you basically just call the event handler for that element. Slight change from your code.
var a = document.getElementById("element"); var evnt = a["onclick"]; if (typeof(evnt) == "function") { evnt.call(a); }