title: Pass a variable from an 'If', 'Else If' or 'Else' statement outside using JQuery?
body: <p>I would like to know if it is possible to pass a variable from inside an 'If', 'Else If' or 'Else' statement to another section without the need of PHP, just using JQuery.</p>
  
  <hr>
  
  <p><strong>JQuery Code:</strong></p>
  
  <pre><code>$('#Info-Side-Tabs a').click(function() {
      var clicked = $(this).attr('href');
      if (clicked == "#Map-Selection-Info-Close") {
          $('#Info-Side-Tabs li').removeClass('active');
          $(this).parent().addClass('active');
          $(this).attr("href","#Map-Selection-Info-Open");
          $(this).text('Open Me');
          $('#Map-Selection-Info').animate({marginLeft: '978px'}, 1000);
          $('#ATWI80C-Map').animate({width: '900px' }, 1000);
      } else if (clicked == "#Map-Selection-Info-Open") {
          $(this).parent().removeClass('active');
          $(this).attr("href","#Map-Selection-Info-Close");
          $(this).text('Close Me');
          $('#Map-Selection-Info').animate({marginLeft: '670px'}, 1000);
          $('#ATWI80C-Map').animate({width: '600px' }, 1000);
      } else {
          $('#Info-Side-Tabs li').removeClass('active');
          $(this).parent().addClass('active');
          var activeTab = $(this).attr('href');
          $('#tab-content &gt; div:visible').hide();
          $(activeTab).show();
          return false;
      }
  });
  </code></pre>
  
  <hr>
  
  <p>In the above, it will close or open my side information with tabs on. if clicked does not equal "#Map-Selection-Info-Close", I need to set a variable of the name. The reason why I would like to do this is that #Map-Selection-Info-Close/#Map-Selection-Info-Open is on the tab switcher, however there is no content for them so it keeps the previous content but switches the class to the active one upon closing. Upon opening, you can see the previous content, however I do not know how to set the active class back to the current content of which is shown.</p>
  
  <p>I'm pretty new to JQuery and this is the best thing I have done so far and I think I am picking up everything so easily now that I have clicked, however I do not know how to, if possible, to do the above and I thank you for any help and/advice in doing what I wish to achieve.</p>
  
  <p>Best Regards,</p>
  
  <p>Tim</p>