Home › Forums › JavaScript › Set/Delete Cookie with Checkbox?? › Re: Set/Delete Cookie with Checkbox??
May 23, 2012 at 7:22 am
#103319
Participant
YEAHHH!!! xD
$("input#togglePre").change(function() {
if ($(this).is(':checked')) {
$("body").addClass('prelight');
createCookie("pre", "prelight", 1000);
} else {
$("body").removeClass('prelight');
eraseCookie("pre", "prelight");
}
});
if (readCookie("pre")) {
$("body").addClass('prelight');
$('input#togglePre').attr('checked', 'checked');
}