gilroyhacks.com/js/data_checkbox.js

15 lines
435 B
JavaScript
Raw Normal View History

2022-06-05 02:23:40 -07:00
var i;
var checkboxes = document.querySelectorAll('input[type=checkbox]');
function save() {
for (i = 0; i < checkboxes.length; i++) {
localStorage.setItem(checkboxes[i].value, checkboxes[i].checked);
2022-06-04 23:43:19 -07:00
}
2022-06-05 02:23:40 -07:00
}
window.onload = function() {
load();
};
function load() {
for (i = 0; i < checkboxes.length; i++) {
checkboxes[i].checked = localStorage.getItem(checkboxes[i].value) === 'true' ? true:false;
2022-06-04 23:43:19 -07:00
}
}