title: How to trigger a click event to skip a next click
body: <p>I have a next button and previous button, When the active variable is 1 i want to skip the next step 2 and proceed directly to step 3. To attain this i used trigger function. this is my code :</p>
  
  <pre><code>    var active = -1;
  
  jQuery('.next').click(function(event){
      if (active &lt; 0) // make sure you only set active value one time
          active = jQuery('ul#checkout_timeline').find('li.active').data('step');
          alert(active);
      if(active == '1')
      {   
          active = 0//prevent active being set to 1 again. 
          jQuery(".next").trigger("click");
          // console.log(active);
          active = jQuery('ul#checkout_timeline').find('li.active').data('step')+1;
          return false;
      }
  </code></pre>
  
  <p>this is working flawlessly i have a similar prev button and i tried using the same code so that when it reaches step 3 and on next "PREV" button click it should skip a step and goto step 1. </p>
  
  <pre><code>jQuery('.prev').click(function(event){
      var active = -1;
      if (active &lt; 0) // make sure you only set active value one time
      {
          active = jQuery('ul#checkout_timeline').find('li.active').data('step');
          alert(active);
      if(active == '3')
      {   
          active = 0//prevent active being set to 1 again. 
          jQuery(".prev").trigger("click");
          // console.log(active);
          active = jQuery('ul#checkout_timeline').find('li.active').data('step');
          return false;
      }
  }
  });
  </code></pre>
  
  <p>but here the alert value keep on returning the value 3 in hitting prev button. what is that am doing wrong.</p>