removeClass() works outside the if statement but not within
<p>I have the following HTML:</p>

<pre><code>&lt;div id="wrapper"&gt;
      &lt;div class="p1"&gt;
          &lt;a href="#" class="quickFlipCta"&gt;&lt;img src="Test Pictures/QuestionMark.gif" /&gt;&lt;/a&gt;
      &lt;/div&gt;

      &lt;div class="p2"&gt;
          &lt;a href="#" class="quickFlipCta"&gt;&lt;img src="Test Pictures/flower.gif" /&gt;&lt;/a&gt;
      &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>Along with some other things, I want the class "quickFlipCta" to be removed after a certain condition. Here is a snippet of my code:</p>

<pre><code>if ( $(this).attr('id') != last.attr('id') ) {
  var that = this;
  var that2 = last;
  setTimeout(function(){
     $(that).parent().parent().quickFlipper({refresh :1}); 
     $(that2).parent().parent().quickFlipper({refresh :1}); 
  }, 1500);
  $('a').removeClass('quickFlipCta');
}
</code></pre>

<p>The first statements work perfectly: </p>

<pre><code>    setTimeout(function(){
        $(that).parent().parent().quickFlipper({refresh :1});
        $(that2).parent().parent().quickFlipper({refresh :1});
    }, 1500);
</code></pre>

<p>However <code>$('a').removeClass('quickFlipCta');</code> does not work.
I figured there was something wrong with it but I tried it outside of the if statement and it worked. Any idea of what could be causing this? Thanks in advance.</p>
