Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Add `.current` class to anchors that link to the current URL.
(function(anchors, url, i, a) {
while ((a = anchors[i++]) && a.classList)
a.href === url && a.classList.add('current');
}(document.getElementsByTagName('a'), location.href, 0));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.