I want to change the class of a particular <li></li>
element and I found a few ways to do so, but non of them worked, can you please tell me the reason why my code is not working >
<script type="text/javascript">
$('.header a[href="register_friend.php"]').parent().setAttribute("class", "active");
</script>
<header class="header" >
<nav><ul>
<li class="active"><a href="index.html">Home</a></li>
<li><a href="register_friend.php">Register a friend</a></li>
<li><a href="">Register Yourself</a></li>
<li><a href="">Contact</a></li>
<li><a href="index.html">Rate</a></li>
</ul>
</nav>
</header>
I would like to add that I am using an external header, if that brings any change.
<body >
<div id="header"></div>
</body>