My files all have a header that includes a navigation bar. I am trying to use jQuery to add the 'active' class to the relevant list items (li).
The method I initially thought of involved setting a variable on each page, assigning an ID equal to that variable for the relevant page, and then using a function to check if they match in order to apply a class to the li element.
However, I believe there must be a simpler way to accomplish this task.
<ul class="nav nav-pills right" id="div">
<li id="home" class="active">
<a href="index.php">Home</a>
</li>
<li id="search">
<a href="search.php">Search</a>
</li>
<li id="contact">
<a href="contact.php">Contact</a>
</li>
</ul>