There are a lot of topics regarding this function, nonetheless I can't seem to get it working. I've googled on this specific case and a bunch of links let me here, but strangly enough I can't seem to get them to work. The only thing I did get working was the following: http://dl.dropbox.com/u/2238080/a/!old/z.htm but as you can see, it doesn't store the state of the box is unchecked.
Regards, Ruben
If you're just interested in one checkbox AND/OR you don't want to include the jQuery cookie plugin for this, here's two lines of code:
This also doesn't use cookies so saves a couple bytes of bandwidth. Change to localStorage to extend lifetime of saved selection.
If you don't strictly need to use cookies, using the newer HTML5 Web Storage (specifically the sessionStorage object in this case) is a lot easier and better than storing in a cookie:
http://www.w3schools.com/html/html5_webstorage.asp
Browser support is pretty full:
http://caniuse.com/#search=sessionstorage
You can change ALL your code to just: EDITED to remove part unneeded.
including getting rid of all these:
EDIT: less verbose version:
working example: http://jsfiddle.net/R73vy/
It should work with jQuery < 1.6 but starting with 1.6 you should change every appearance of
.attr("checked")
to.prop("checked")
EDIT: Changed the if condition for checking the cookie