title: JQuery set active link
body: <p>i have a horizontal CSS Menu with this JQuery code:</p>
  
  <pre><code>function setActiveLink(target) {
          $(".MenuLink").removeClass("active");
          $('a[href=' + target + ']').addClass("active");
          //$('.tabcontent').addClass('hide');
          $(target).removeClass('hide');
      }
  
      $(document).ready(function(){
      $('.MenuLink').click(function(e) {
          e.preventDefault();
          var target = $(this).attr('href');
          document.location.hash = target;
          setActiveLink(target);
      });
      });
  </code></pre>
  
  <p>i want to set an active class on the clicked link (and remove all other active classes)</p>
  
  <p>also, i want to be able to add the active class on the parent item when a sub menu item is clicked.</p>
  
  <p>i tried creating the above function, but it doesnt add the class</p>
  
  <p>i created a fiddle here with my full code:</p>
  
  <p><a href="http://jsfiddle.net/e79nz1cj/" rel="nofollow">http://jsfiddle.net/e79nz1cj/</a></p>