If I understand correctly, to programmatically trigger a jQuery click event attached to an object with a css class of my-button
, you should be able to just do t
This turned out to be a case of two jQuery scripts being loaded. The script retrieved via JSONP included the loading of jQuery, and that jQuery object was used to attach the event handler. Meanwhile, in my co-worker's web page, he had loaded his own jQuery. Therefore, this second jQuery object, having no knowledge of the first's event handlers, was unable to programmatically invoke the handler.
Go back to the dom and do it with:
$("abutton")[0].click();
I also ran into this but I did not have multiple jQuery.
Reading through the answers here I realized it was because of the order of execution. I was binding the event handler a few lines after I had the function that invoked the click.
It was a DOH! moment...