Highlight All Links To Current Page
This function will add the class “selected” to any links (even relative) that point to the current page. $(function(){ $(“a”).each(function(){ if ($(this).attr(“href”) == window.location.pathname){ $(this).addClass(“selected”); } }); });