I am trying to achieve preserving check box state after reload when check box checked or unchecked and an if statement for check and uncheck. What I am doing wrong or what’s the best way to do it?
$('.js-bbCheckbox').click(function(event) {
$('.js-bbCheckbox').change(function(){
if($(this).is(':checked')){
window.location = '?filter=topRated';
}else{
window.location = '?filter=nottopRated';
}
});
So, you’re able to set the location, but you need the page to change the checkbox based on the filter. This way, you don’t need to save a cookie.