title: how to make <li> add css class active after refreshing page?
body: <p>after clicking <code>li</code> item. i set <code>active</code> attribute to css class but <code>li</code> has a link to forward another page. active css disappear? how to do this? i have been used localstorage to cache my old selected li item. i can not find any solution. How to make alive active class setting after refreshing? how to set active class alive after refreshing page?</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  $(document).ready(function () {
  
      $("li").click(function () {
          var id = $(this).attr("id");
          console.log(id);
  
          var selectedolditem = localStorage.getItem('selectedolditem');
          if (selectedolditem != null) {
  
              $('#' + selectedolditem).siblings().find("active").removeClass("active");
              $('#' + selectedolditem).addClass("active");
              localStorage.clear();
              return;
  
          }
  
          $('#'+id).siblings().find("active").removeClass("active");
          $('#' + id).addClass("active");
          localStorage.setItem("selectedolditem", id);
  
      });
  });
  </code></pre>
  
  <p></p>