I've done my best to search all of the answers and can't find anything that answers this specifically. So, if you find something, please let me know and I'll remove this right away.
I created a JSFiddle to show my problem (JS portion copied below for ease of reference): http://jsfiddle.net/hg67R/1/
When I am trying to set the value of a checkbox based on the value of a variable it will not seem to set correctly. The example I created should save the current state of each checkbox (which is does correctly). Then, no matter how you change those checkboxes, it should change them back when you click load. The storage variables are correct but it is not setting the checkboxes correctly. I'm certain it is something obvious but I sure can't see it.
function save() {
localStorage.setItem("numbers", document.getElementById("Numbers").checked);
localStorage.setItem("tips", document.getElementById("Tips").checked);
}
function load() {
document.getElementById("Numbers").checked = localStorage.numbers;
document.getElementById("Tips").checked = localStorage.tips;
console.log("numbers storage: " + localStorage.numbers);
console.log("numbers box: " + document.getElementById("Numbers").checked);
console.log("tips storage: " + localStorage.tips);
console.log("tips box: " + document.getElementById("Tips").checked);
}
The console.logs just show me that the variables are storing and loading correctly.
Thanks!