Tutorial Highlight All Links To Current Page
$(function(){ $("a").each(function(){ if ($(this).attr("href") == window.location.pathname){ ...
https://iskablogs.blogspot.com/2014/03/tutorial-highlight-all-links-to-current.html
$(function(){
$("a").each(function(){
if ($(this).attr("href") == window.location.pathname){
$(this).addClass("selected");
}
});
});
This function will add the class "selected" to any links (even relative) that point to the current page.
$("a").each(function(){
if ($(this).attr("href") == window.location.pathname){
$(this).addClass("selected");
}
});
});
This function will add the class "selected" to any links (even relative) that point to the current page.