This is the gohtml code containing the checkbox and the input fields with id="number"
How do I ensure with JavaScript that when the checkbox is clicked, all the input fields are automatically entered with the number 0?
Thanks in advance!
I need more than that, but for answering I am assuming your checkbox has id=chkbox
what we can do is add an event listener to the checkbox
let checkbox = document.getElementById("chkbox");
let inp = document.getElementById("number");
checkbox.addEventListener('change', function() {
if (this.checked) {
inp.value = 0;
}
});
This should do the trick