The easiest way to use onClick ..
<input type="checkbox" onclick="document.getElementById('sp-click').innerHTML = 'Check Box = ' + this.checked;" id="click"> <span id="sp-click"></span>
You can use this to change the style / visibility of certain divs to hide and show them.
eg.
<input type="checkbox" onclick="changeClass(this.checked);" id="click"> <script> function changeClass(checkbox){ var divone = document.getElementById('divone') var divtwo = document.getElementById('divtwo') if(checkbox == 'true'){ divone.style.display = "none"; divtwo.style.display = "inline"; } else { divone.style.display = "inline"; divtwo.style.display = "none"; } } </script>
source share