Is there a way to make the link that is clicked on active? I have attempted various scripts but have had no luck in getting the desired effect. Can anyone identify what might be causing the issue?
$("a").click(function () {
if ($(this).hasClass("active")) {
$(this).removeClass("active");
} else {
$(this).addClass("active");
}
});
nav ul li a:hover,
nav ul li a.active {
color: #23dbdb;
}
<nav>
<ul>
<li><a class="active" href="Login.html" target="dest">Home</a></li>
<li><a href="buttonsstudent.html" target="dest">Result</a></li>
<li><a href="card4.html" target="dest">Subjects</a></li>
<li><a href="aboutpage.html" target="dest">About</a></li>
</ul>
</nav>