title: Appending class to anchor based on page
body: <p>I'm trying to add a navigation portion of my site and have the current page in the sidebar have the class "current" to change it's color. I'm using jQuery as if I'm not mistaken, addClass works in IE 8 and 9 whereas using javascript will require extra coding to get it to be cross browser compatible. </p>
  
  <pre><code>&lt;div id="link_location"&gt;onandon&lt;/div&gt;
  
  &lt;script type="text/javascript"&gt;
      var id = document.getElementById('link_location').innerHTML;
      $("'#"+ id +"'").addClass('current');
  &lt;/script&gt;
  
  &lt;div id="sidebar"&gt;
      &lt;div id="links"&gt;
          &lt;li&gt;&lt;a id="allofnothinginstall" href="allofnothinginstall.html"&gt;All of Nothing&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a id="onandon" href="onandon.html"&gt;on and on&lt;/a&gt;&lt;/li&gt;
      &lt;/div&gt; 
  &lt;/div&gt;
  </code></pre>
  
  <p>I'm sure there are neater ways to do it, but I'm still learning javascript and don't know how to pull the url from the window location and only keep the page name. Any help is greatly appreciated!</p>