Javascript get current page and add class to an element depending on the URL
<p>I'm using a navigation bar, and I want to have an active class on elements when they're on the element's page. </p>

<p>For instance, I'd need jQuery to check the url of the current page, and if the url is <code>http://supjamess.tumblr.com/</code>, it'd add the class <code>active</code> to the <code>a</code> element <code>.index</code>, <code>http://supjamess.tumblr.com/ask</code> &amp; it'd add the class <code>active</code> to the <code>a</code> element <code>.ask</code>, and so on. </p>

<p>If anyone could provide a code it'd be extremely helpful.</p>
