title: Trying to keep selected div in navbar active after page refresh
body: <p>I am trying to keep selected tab active on reload. Tried and checked with some question already been asked here but none of work for me. So far, it the active class correctly jumps on click but the click directs me to a new page and then it switches back to the default active div. Here is my code:</p>
  
  <p><strong>navbar.html.erb</strong></p>
  
  <pre><code>&lt;%= link_to activities_path, :class =&gt; "icon active" do %&gt;
        &lt;i class="fas fa-home icon-selector"&gt;&lt;/i&gt;
        &lt;p&gt;Home&lt;/p&gt;
    &lt;% end %&gt;
    &lt;%= link_to new_list_path, :class =&gt; "icon" do %&gt;
        &lt;i class="fas fa-edit icon-selector"&gt;&lt;/i&gt;
        &lt;p&gt;New List&lt;/p&gt;
    &lt;% end %&gt;
  </code></pre>
  
  <p><strong>update_icon.js</strong></p>
  
  <pre><code>$(document).ready(function() {
   $(".icon").click(function () {
  $(".icon").removeClass("active");
  // $(".tab").addClass("active"); // instead of this do the below
  $(this).addClass("active");
   });
  });
  </code></pre>