the idea is I've a dark mode,i done with it ,but the problem ,when i reload the page the dark mode gone
this is HTML code
<input type="checkbox" id="darkMode" name="">
and this is js code ( with this way doesn't run )
var ele = 'body';
$('#darkMode').on('click',function(){
if( $('#darkMode').prop('checked') ){
$(ele).addClass('dark-mode');
// here i wanna save the value of darkMode in browser
$.cookie('darkMode', 'dark', { expires: 7, path: '/' });
}else{
$(ele).removeClass('dark-mode');
}
});
thanks !