I have the following HTML:
<div class="side-button">
<a href="/first"> First Option <a>
</div>
<div class="side-button">
<a href="/second"> Second Option <a>
</div>
When user click on one of the blocks, I want it to become active, so that I can highlight it with another color.
In my jQuery I'm trying to add class active
on the clicked block:
jQuery(document).ready(function( $ ){
$(".side-button").bind('click', function () {
$(".side-button").removeClass("active");
$(this).addClass("active");
});
});
It works while next page is loading. After redirect, it doesn't remember active
class.
How can I add class active
so it will remember that on the loaded page?