I've recently made a site where I have a navigation bar, which is included to the pages using PHP.
<?php include "Assets/Inclusions/NavigationBar.php" ?>
I wanted the active page list item to have bold text, so I used JavaScript to fetch the current path and make the relative element bold with a lot of if statements.
<script>
if(location.pathname == 'location.php')
document.getElementById("location").style.fontWeight="800";
} ...and so on
</script>
Is there a better way I should have done this?