If you want the active to stay, you COULD use sessionStorage, but why not just ajax the page
https://plungjan.name/SO/ajaxnav/index.html
$(document).ready(function() {
$("#nav a").on("click", function(e) {
e.preventDefault();
// remove classes from all
$("#nav li").removeClass("active");
// add class to the one we clicked
$(this).closest("li").addClass("active");
$("#content").load(this.href);
}).eq(0).click();
});
.active {
background-color: yellow;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<ul id="nav">
<li class="active"><a href="dashboard.php"><i class="ti-dashboard"></i>Dashboard</a></li>
<li><a href="resume.php"><i class="ti-wallet"></i>My Resume</a></li>
<li><a href="employer-list.php"><i class="ti-wallet"></i>Browse Jobs</a></li>
<li><a href="assess.php?q=1"><i class="ti-wallet"></i>Assessment</a></li>
<li><a href="jobs.php"><i class="ti-hand-point-right"></i>Applied Jobs</a></li>
</ul>
<div id="content"></div>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…