const checkbox = document.querySelector("input[name=checkbox]"); checkbox.addEventListener("change", (e) => { if (e.target.checked) { console.log("Checkbox is checked.."); } else { console.log("Checkbox is not checked.."); } });