I’m trying to simulate a user clicking an element by using:
el = document.getElementById('#inputToClick');
oEvent = document.createEvent("MouseEvents");
oEvent.initMouseEvent("click", true, false, window, 1, 1, 1, 1, 1, false, false, false, false, 0, null);
el.dispatchEvent(oEvent);
This works for another site where jQuery’s $el.click() does not, but I’ve found a site where jQuery’s click works but the above does not. I was hoping some one could point me to the relevant parts of the jQuery source.
If you’re realy looking for the source of the click function of jQuery 1.7.2:
source:
Jquery.Click Function
And if you just wanted to know how to click on something…