I want to add class active to the <li> whenever specific url is accessed?
my code look like this,
<ul>
<li>
<a href="link1">Link1</a>
</li>
<li>
<a href="link2">Link2</a>
</li>
<li>
<a href="link3">Link3</a>
</li>
<li>
<a href="link4">Link4</a>
</li>
<li>
<a href="link5">Link5</a>
</li>
<li>
<a href="link6">Link6</a>
</li>
</ul>
if http://www.abc/link1 is is present in the url then only 1st li should be active and rest of them should not have any class.
Thnks in advance
Here is how you could do it with JavaScript…