title: jQuery: Add Class Active to <a> with current page href
body: <p>I am looking for a way to add an active class to the  tag that has an href of the current page.</p>
  
  <p>Say I am on the page localhost:3000/inbox, I need my html to change add the correct class to the correct  which are all located in the div with the class sidebar.</p>
  
  <p>So when at "/inbox" jQuery should make my html look like this:</p>
  
  <pre><code>&lt;div class="sidebar"&gt;
  &lt;a href="/link"&gt;
    &lt;i class="fa fa-inbox"&gt;&lt;/i&gt;
    &lt;span&gt;A Link&lt;/span&gt;
  &lt;/a&gt;
  &lt;a class="active" href="/inbox"&gt;
    &lt;i class="fa fa-inbox"&gt;&lt;/i&gt;
    &lt;span&gt;Inbox&lt;/span&gt;
  &lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This is what I tried, but it doesn't work, it breaks the code:</p>
  
  <pre><code>var href = $(location).attr('href');
    ('.sidebar').find('a[href*=href]').addClass("active");
  </code></pre>
  
  <p>Thank you. Please let me know if I wasn't clear enough.</p>