title: JQuery change class when a link is clicked
body: <p>I'm new to <code>JQuery</code>, I know this question is already answered in other posts but please help me on this,
  How can i change the class of <code>&lt;li&gt;</code> tag if a link <code>&lt;a&gt;</code> is clicked?</p>
  
  <pre><code>&lt;li class="link" id="home" &gt;
     &lt;a href="admin?main=home"&gt;Home&lt;/a&gt;
  &lt;/li&gt;
  &lt;li class="link" id="flt" &gt;
     &lt;a href="admin?main=flt"&gt;FLT&lt;/a&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>This is what i have tried so far:<br></p>
  
  <pre><code>$('li').click(function() {
      $("li.active").removeClass("active");
      $(this).addClass('active');
  });
  </code></pre>
  
  <p>Please explain me the answer, other posts that is similar to mine doesn't have that much detail so i really don't understand how they do that?</p>