function func2() { var elem = document.getElementById('checbox0'); var elem1 =document.getElementById('checbox1'); elem1.checked=true; }
<input type="checkbox" id="checbox0">checkbox0 <input type="checkbox" id="checbox1">checkbox1 <button>Click!</button> <script> function func2() { var elem = document.getElementById('checbox0'); var elem1 =document.getElementById('checbox1'); elem1.checked=true; } document.querySelector("button").addEventListener("click", func2); </script>