gilroyhacks.com/js/data_checkbox.js

55 lines
1.7 KiB
JavaScript
Raw Normal View History

2022-06-12 13:51:47 -07:00
// Gilroy Hacks Website Source Code -> JS (https://gilroyhacks.com)
2022-06-05 02:23:40 -07:00
var i;
2022-06-09 16:55:46 -07:00
var checkboxes = document.querySelectorAll('#signup-container input[type=checkbox]');
2022-06-09 22:02:33 -07:00
var verify = true;
2022-06-05 02:23:40 -07:00
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
}
2022-06-07 01:40:29 -07:00
}
2022-06-09 16:55:46 -07:00
function check(id) {
2022-06-07 01:40:29 -07:00
document.getElementById(id).checked = true;
2022-06-07 14:46:42 -07:00
}
2022-06-09 22:02:33 -07:00
function uncheck(id) {
document.getElementById(id).checked = false;
}
2022-06-20 02:33:38 -07:00
function notification(id) {
2022-06-09 22:02:33 -07:00
if (localStorage.getItem(checkboxes[id].value) != true) { verify = false; }
if (verify) { document.getElementById('notification').style.visibility = visible; }
2022-06-22 02:06:21 -07:00
}
// function btnToggle() {
// if (document.getElementById('#check').checked) {
// document.getElementById('#check').checked = false;
// }
// else {
// document.getElementById('#check').checked = true;
// }
// }
document.getElementById('#check').addEventListener('click', function (event) {
if (!document.getElementById('check').checked) {
event.stopPropagation();
}
});
window.onclick = function(event) {
if (!event.target.matches('check')) {
if (document.getElementById('check').checked) {
document.getElementById('check').checked = false;
}
}
}
// document.getElementById("navList").addEventListener('click', function (event) {
// if (document.getElementById('check').checked) {
// event.stopPropagation();
// }});