Console.logs are not showing. And my functions are not working. I tried several different functions and solutions but none of them worked for me. Where is the problem can anyone help?
this my html
<div class="switch-toggle darkmodecheckbox">
<input type="checkbox" name="checkbox" id="darkmodeonoff" />
<label for="darkmodeonoff"></label>
</div>
this my js;
var checkbox = document.querySelector("input[name=checkbox]");
console.log(checkbox);
checkbox.addEventListener("change", (e) => {
if (e.target.checked) {
darkmode();
console.log("Checkbox is checked..");
} else {
darkmodeoff();
console.log("Checkbox is not checked..");
}
});
Aucun commentaire:
Enregistrer un commentaire