title: jQuery add class to active tab parent element
body: <p>I have this jQuery that is displaying content when a div is clicked...</p>
  
  <pre><code>&lt;ul&gt;
      &lt;li class="tab"&gt;&lt;a class="link" href="#" data-rel="content1"&gt;Link 1&lt;/a&gt;&lt;/li&gt;
      &lt;li class="tab"&gt;&lt;a class="link" href="#" data-rel="content2"&gt;Link 2&lt;/a&gt;&lt;/li&gt;
      &lt;li class="tab"&gt;&lt;a class="link" href="#" data-rel="content3"&gt;Link 3&lt;/a&gt;&lt;/li&gt;
      &lt;li class="tab"&gt;&lt;a class="link" href="#" data-rel="content4"&gt;Link 4&lt;/a&gt;&lt;/li&gt;
      &lt;li class="tab"&gt;&lt;a class="link" href="#" data-rel="content5"&gt;Link 5&lt;/a&gt;&lt;/li&gt;
  &lt;/ul&gt;
  
  &lt;div class="content-container"&gt;
      &lt;div id="content1"&gt;This is the test content for part 1&lt;/div&gt;
      &lt;div id="content2"&gt;This is the test content for part 2&lt;/div&gt;
      &lt;div id="content3"&gt;This is the test content for part 3&lt;/div&gt;
      &lt;div id="content4"&gt;This is the test content for part 4&lt;/div&gt;
      &lt;div id="content5"&gt;This is the test content for part 5&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <pre class="lang-js prettyprint-override"><code>$(".link").click(function() {
      $('.content-container div').fadeOut('slow');
      $('#' + $(this).data('rel')).fadeIn('slow');
  });
  </code></pre>
  
  <p><a href="http://jsfiddle.net/mjj70qjk/" rel="nofollow">http://jsfiddle.net/mjj70qjk/</a></p>
  
  <p>It is working great, what i want to do now though is add a class to the li for whichever tab is active so that I can style it.  I have this...</p>
  
  <pre><code>        jQuery(document).ready(function() {
   jQuery( function() {
      jQuery(".link").click(function() {
        if( jQuery( this ).hasClass( 'active' ) ) {
           return;
        }
  
        jQuery(".link").removeClass( 'active' );
        jQuery( this.parentNode ).addClass( 'active' );
  
        jQuery('.content-container div').fadeOut('slow');
        jQuery('#' + jQuery(this).data('rel')).fadeIn('slow');
    });
  });
  });
  </code></pre>
  
  <p>Which is working but it doesn't remove the class, where am i going wrong?</p>