title: Show one div while hiding other divs with jquery when clicking on links
body: <p>I am trying to create a navigation scheme that has a series of links and number of divs. When I click on link 1 I want to show div 1. If I click on link 2 I want to hide 1 and show 2 etc. </p>
  
  <p>I was able to get the following code to work. However, what is happening is when any other link on the page is clicked the div that is currently being displayed disappears/hides. </p>
  
  <p>I have tried various solutions but have been unable to figure this out. Can someone provide some insights to what may be happening based on the code below. </p>
  
  <p>HTML:</p>
  
  <pre><code>    &lt;ul id="navigation"&gt;
          &lt;li data-tab="property" class="activeitem settingLink active"&gt;&lt;a href="#"&gt;Property Flyers&lt;/a&gt;&lt;/li&gt;
          &lt;li data-tab="openhouse" class="settingLink"&gt;&lt;a href="#"&gt;Open House Flyers&lt;/a&gt;&lt;/li&gt;
          &lt;li data-tab="postcards" class="settingLink"&gt;&lt;a href="#"&gt;Postcards&lt;/a&gt;&lt;/li&gt;
          &lt;li data-tab="mortgage" class="settingLink"&gt;&lt;a href="#"&gt;Mortgage Flyers&lt;/a&gt;&lt;/li&gt;
          &lt;li data-tab="recruiting" class="settingLink"&gt;&lt;a href="#"&gt;Recruiting Flyers&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
  
  
      &lt;div id="property" class="span-18 last"&gt;&lt;img src="images/templates/thumbs/property84.jpg" width="143" height="194" /&gt;&lt;/div&gt;
      &lt;div id="openhouse" class="span-18 last"&gt;&lt;img src="images/templates/thumbs/property84.jpg" width="143" height="194" /&gt;&lt;/div&gt;
      &lt;div id="Postcards" class="span-18 last"&gt;&lt;img src="images/templates/thumbs/property84.jpg" width="143" height="194" /&gt;&lt;/div&gt;
      &lt;div id="Mortgage" class="span-18 last"&gt;&lt;img src="images/templates/thumbs/property84.jpg" width="143" height="194" /&gt;&lt;/div&gt;
      &lt;div id="Recruiting" class="span-18 last"&gt;&lt;img src="images/templates/thumbs/property84.jpg" width="143" height="194" /&gt;&lt;/div&gt;
  </code></pre>
  
  <p>JavaScript:</p>
  
  <pre><code>$('a').on('click', function(e) {
      e.preventDefault();
      var $li = $(this).closest('li');
  
      var tab = $li.data('tab');
      var current = $('.active.settingLink').data('tab');
  
      $('#' + current).fadeOut('fast', function() {
          //Slide the new div down
          $('#' + tab).fadeIn();
      });
  
      //Remove active class from current link
      $('.active.settingLink').removeClass('active');
  
      $li.addClass('active');
  });
  </code></pre>