1

There are 1 best solutions below

4
On

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