I have a separate layout in my project, where it is standard for all pages. how to do in the left menu, the active class is activated according to the selected page.
I have the html code:
<div class="sidebar-sticky">
<ul class="nav flex-column">
<li class="nav-item active">
<a class="nav-link" href="~/Alunos/Index/">Alunos</a>
</li>
<li class="nav-item">
<a class="nav-link" href="~/Funcionarios/Index/">Funcionarios</a>
</li>
</ul>
</div>
And I tried to make it work with the script
jQuery(function() {
$("a").click(function() {
$("a").removeClass("active");
$(this).addClass("active");
});
}
But it does not work, any suggestions?