JSFiddle - React, Tailwind, and code Playground
HTML
<ul id="nav">
<li><a href="index.php">home</a></li>
<li><a href="custHelp.php">who we are</a>
<ul>
<li id="changeBG1"><a href="about.php">about</a></li>
<li id="changeBG2"><a href="help.php">team</a></li>
</ul>
</li>
CSS
a:link {
background-color: blue;
}
.active{
background-color: red;
}
JavaScript
var url = window.location.href;
url = url.substr(url.lastIndexOf("/") + 1);
// For this example only
url = "about.php";
////////////////////////
$("#nav a[href$='" + url + "']").addClass("active");