I'm currently trying to save if someone has checked a HTML checkbox and save it with localStorage
in Javascript. Please read over this code and tell me the bugs.
<!DOCTYPE html>
<html>
<head>
<script>
var CheckBox = document.getElementById("Box");
if(localStorage.Box1 == 1) {
document.getElementById("Blank").innerHTML = "Hello";
}
function Box() {
if(CheckBox.check) {
localStorage.Box1 = 1;
} else {
localStorage.Box1 = 0;
}
}
</script>
</head>
<body>
<input type="checkbox" id="Box" onclick="Box()">
<p id="Blank"></p>
</body>
</html>