I am trying to add an active class to nav item, depending what page your on. I am using this script:
Here is a possible solution: https://jsfiddle.net/6yyLpma1/
$("#side-bar a").click(function () {
var id = $(this);
$('#side-bar').find(".active").removeClass("active");
$(id).addClass("active");
localStorage.setItem("selectedolditem", id);
});
Instead of $(id).siblings()
use $('#side-bar')
. Use the same logic in other location.