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>
Aucun commentaire:
Enregistrer un commentaire