title: jQuery .trigger() method in a loop
body: <p>I have this piece of code:</p>
  
  <pre><code>$(document).on("click", "#breadNavMain", function() {
      for(var i = 0; i &lt; getActiveSlides().length; i++) {
          $("#studentWrapper").trigger("click");
      }
  });
  </code></pre>
  
  <p>The method <code>getActiveSlides()</code> will return the slides (as an array) currently activated for my application. What's import is that I am getting the number of slides that are active. For anything over 1 active slide, the loop above does not work. If I have 3 active slides (for example), it will only call the <code>.trigger()</code> method once. Within my click handler, if I instead use:</p>
  
  <pre><code>$("#studentWrapper").trigger("click");
  $("#studentWrapper").trigger("click");
  $("#studentWrapper").trigger("click");
  </code></pre>
  
  <p>It will work just fine. The problem is that I don't know how many times I'll need to call the <code>.trigger()</code> method so I am unable to do this manually. I wanted to call it inside of a loop like I tried to above. Is there anyway to get <code>.trigger()</code> to work inside of a loop?</p>