title: How to mantain active a nav tab using jquery?
body: <p>I'm using this js to put active a nav tab in my web page:</p>
  
  <pre><code>  $('a[href="' + this.location.pathname + '"]').parents('li,ul').addClass('active');
  </code></pre>
  
  <p>It works in the same level(secured/buyer_user/inbox/get/new_purchase)of the view, but if I change a location like secured/buyer_user/inbox/get/new_purchase the nav tab get inactive.</p>
  
  <p>I have the following page structure:</p>
  
  <pre><code>&lt;nav class="navbar navbar-default navbar-fixed-top" id="nav" name="nav"&gt; 
      &lt;div class="container-fluid"&gt;
          &lt;ul class="nav navbar-nav hover"&gt;
             &lt;li&gt;...&lt;li&gt;
          &lt;ul&gt;
      &lt;/div&gt;
  &lt;/nav&gt;
  </code></pre>
  
  <p>Any help would be great.</p>