title: add class on li remove after page load
body: <p>I am using jquery to add the class to active css on "li" and also navigate to an html page.but after page navigates the class disappers on "li". I have tried different ways to resolve this but couldn't get the point.</p>
  
  <pre><code>$(document).ready(function(){
      $( '#topList ul li' ).click(function() {
          alert($(this).attr('id'));
  
  
          if($(this).attr('id') == "add") {            
              document.location.href = 'localhost:8080/add';
              $(this).attr('id').addClass("active");            
          }
      });    
  });
  </code></pre>
  
  <p>here is the menu list, what I want is when I click on li it should call a page add and also add a class on that li.</p>
  
  <p>html code</p>
  
  <pre><code>&lt;ul class="nav"&gt;
      &lt;li class="" id="add"&gt;&lt;a href="javascript:void(0);"  &gt;&lt;i class="add"&gt;&lt;/i&gt; Add&lt;/a&gt;      &lt;/li&gt;
  &lt;ul&gt;
  </code></pre>