Using a list for navigation, I am looking for a clean way to apply the \'selected\' class to a list item if the page URL (minus anything after the path) matches the href of the
Assuming there isn't any '?' character in the actual path you could use something like this for both the location and the href:
function getBaseURL(url) { return url.split('?')[0]; }