I'm currently trying to make a javascript function to check if a link on the page links to the same page, and if so, add a class to it.
What I currently have:
$(document).ready(function() {
var currentPage = location.pathname;
if $("a[href*=currentPage]") {
$("a").addClass( "active" );
}
});
However, this doesn't seem to work. Any help appreciated.
()=>if ($("a[href*=currentPage]")) {...}