Changing the CSS of a file included with PHP using JavaScript

Monday, June 30, 2014

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.

if(location.pathname == 'location.php')
} ...and so on

Is there a better way I should have done this?