I am currently trying to make a navigation-menu where an active-class is applied to the anchors whose href attributes that match the c
navigation-menu
active-class
href
I think you can simplify this a bit:
function highlightSelected() { $("h2.subnav a").each( function() { if (location.pathname.indexOf(this.href) > -1) { $(this).addClass("selected"); } } ); }