I have a side navigation bar:
<li class="side-nav-tab">
<a href="/item"><i class="fa fa-dashboard fa-fw"></i> Items<span></span></a>
</li>
<li class="side-nav-tab">
<a href="/client"><i class="fa fa-bar-chart-o fa-fw"></i> Clients<span></span></a>
</li>
<li class="side-nav-tab">
<a href="/quote"><i class="fa fa-table fa-fw"></i> Quotes<span></span></a>
</li>
jQuery:
$(document).ready(function(){
$('.side-nav-tab').on('click', function(){
var arrow = $(this).find('span').attr('class');
if ((arrow == undefined) || (arrow == '')) {
$('.side-nav-tab').find('span').not(this).removeClass('fa arrow');
$(this).find('span').addClass('fa arrow');
}
})
})
The code above works (adds the class 'fa arrow' to the span) but it's only temporary. The problem is that when you click $('.side-nav-tab'), it directs you to that route, does a page reload, and I lose the 'fa arrow' class I just added.
After doing some research, it appears I could use localStorage, but have been unsuccessful in trying:
var storage = localStore.getItem(arrow)
Any thoughts?
Thanks