I would like the selected element to be remembered by the browser. It's my first time to use js-cookie and I find the documentation very lacking. My inexperience doesn't help either so I decided to ask for some help here.
HTML
<ul>
<li class='selected' id='item1'>
<img src='https://dummyimage.com/100x100/000/fff'/>
</li>
<li id='item2'>
<img src='https://dummyimage.com/100x100/000/fff'/>
</li>
<li id='item3'>
<img src='https://dummyimage.com/100x100/000/fff'/>
</li>
</ul>
CSS
ul{margin:0;padding:0}
li{float:left;list-style-type:none}
img{margin-left:5px}
.selected img{border:3px solid red}
Script
$('li').on('click', function(){
$(this).siblings().removeClass('selected')
$(this).addClass('selected');
})
Here's the JsFiddle of what I'm trying to accomplish. https://jsfiddle.net/cb7pf26u/3/