title: Add active class to anchors inside list with Jquery
body: <p>i'm using AdminLTE v3 and I can't add active state to menu items with jquery. I searched but there's only examples for v2 and the the anchors are the ones with the active class instead the list items. </p>
  
  <pre><code>&lt;ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false"&gt;
      &lt;li class="nav-header text-center pb-1"&gt;&lt;strong&gt;Menu de Navegação&lt;/strong&gt;&lt;/li&gt;
      &lt;li class="nav-item has-treeview"&gt;
          &lt;a href="#" class="nav-link"&gt;
              &lt;i class="fas fa-clipboard-list"&gt;&lt;/i&gt;
                  &lt;p&gt;Artigos
                       &lt;i class="right fas fa-angle-left"&gt;&lt;/i&gt;
                  &lt;/p&gt;
          &lt;/a&gt;
          &lt;ul class="nav nav-treeview"&gt;
              &lt;li class="nav-item"&gt;
                  &lt;a href="/Account/Users/NovoArtigo.aspx" class="nav-link animsition-link"&gt;
                      &lt;i class="fas fa-circle-o nav-icon"&gt;&lt;/i&gt;
                      &lt;p&gt;Novo Artigo&lt;/p&gt;
                  &lt;/a&gt;
               &lt;/li&gt;
               &lt;li class="nav-item"&gt;
                   &lt;a href="/Account/Users/ListarArtigos.aspx" class="nav-link animsition-link"&gt;
                       &lt;i class="fas fa-circle-o nav-icon"&gt;&lt;/i&gt;
                      &lt;p&gt;Listar Artigos&lt;/p&gt;
                   &lt;/a&gt;
               &lt;/li&gt;
           &lt;/ul&gt;
       &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>here is the jquery used in AdminLTE v2, i just changed the classes names according to the ones in v3</p>
  
  <pre><code>var url = window.location;
  
  // for sidebar menu entirely but not cover treeview
  $('ul.nav-sidebar a &gt; i').filter(function () {
      return this.href == url;
  }).parent().siblings().removeClass('active').end().addClass('active');
  
  // for treeview
  $('ul.nav-treeview a').filter(function () {
      return this.href == url;
  }).parentsUntil(".nav-sidebar &gt; .has-treeview").siblings().removeClass('active').end().addClass('active')
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <pre><code>$('ul.nav-sidebar a').filter(function () {
      return this.href == url;
  }).addClass('active');
  </code></pre>
  
  <p>this one seems to be working for the anchors insde the nav-treeview. Can't access to the anchor inside the 2nd list item.</p>
  
  <p>With this one I can set all anchors with active</p>
  
  <pre><code>var c = $('.nav li a').each(function () {
     return this.href == url;
  }).addClass('active');
  </code></pre>