How to set cookies/localStorage within jQuery to remember button state

I have some code here, which changes the layout view on my page, I want to use cookies or localStorage to remember the choice so that the view is correct when my infinite scroll loads but I’m not sure how to do it, here’s the code that changes the view:

$(document).ready(function() {
$(‘#three-view’).click(function() {
$(‘.col-md-2’).addClass(‘col-md-4’);
$(‘.col-md-4’).removeClass(‘col-md-2’);
});

$(‘#six-view’).click(function() {
$(‘.col-md-4’).addClass(‘col-md-2’);
$(‘.col-md-2’).removeClass(‘col-md-4’);
});
});

The page can be viewed here: http://pha-group.com/models/females/

Read more here:: How to set cookies/localStorage within jQuery to remember button state

Leave a Reply

Your email address will not be published. Required fields are marked *