I have a show / hide div which is toggled by a checkbox state, although it works fine I would like to have localStorage save the checkbox state, but I don't know how to implement the local storage part of the code and where to place it. Any help gratefully received.
$(document).ready(function() {
$('#checkbox1').change(function() {
$('#div1').toggle();
});
});
<input type="checkbox" id="checkbox1" value="1" />
<div id="div1">Text to be toggled</div>
jsfiddle
Try this: http://jsfiddle.net/sQuEy/4/
I had to save the value of checkbox in local storage, maybe that would guide you a bit for storing data in local storage. I made a checkbox and a button. On clicking the " save" button, a function is called which gets the id of checkbox and stores it with localStorage.setItem().
check this:
LocalStorage