title: Make a click event happen X amount of times
body: <p>I'm trying to make a click event happen X amount of times depending on the result of some maths. There are multiple rows with buttons that have the button I need pressing so i've got it looking through as you can see. However how do I make it so that the <code>$(obj).click();</code> is fired <code>numClickVar</code> times?</p>
  
  <pre><code>$("#bookOutAll2").on("click", function (e) {
      $(".ControlButtonPLUS").each(function(i, obj) {
          var data = $(this).closest("tr").find(".bookedOutText").text();
          var data2 = $(this).closest("tr").find(".requestedQty").text();
          var numClickVar = data2 - data ;
  
          setTimeout(function() {
              if (numClickVar &gt; 0) {
                  // **** needs to happen numClickVar of times *****
                  $(obj).click();
              }
          }, 450 * i);
      });
  })
  </code></pre>
  
  <p>Any ideas?</p>