For further clarification, the way I'm calling that is as follows: for (var x = 1; x <= count; x++) { $("#button").triggerHandler("click"); }
which is inside of a function that I call on page load, and it isn't working at all. Thanks, T.J. On Dec 8, 1:32 pm, "T.J." <theimmortal...@gmail.com> wrote: > Hi all, > > I have a click event bound to a button that I'm needing to call > without any user interaction on the button. I'm using the fragment > portion of the URL to determine how many times the button's "click" > function needs to fire and using a for loop to (attempt to, at least) > trigger the click. I've tried this with .click(), .trigger("click"), > and .triggerHandler("click") but with no success. I could write a > JavaScript function and call that within the loop, but that's > unnecessary code.. > > Is what I'm doing valid, or can the .trigger/.triggerHandler methods > not be called from within a loop? The syntax I'm using is as follows: > > $("#button").triggerHandler("click"); > > Thanks, > T.J.