html checkbox on check
snippet in html

html checkbox on check

user5798

<input type="checkbox" onchange="doSomething(this)">

function doSomething(element){
   var isChecked=element.checked;
	//do some action if it is checked
}

html checkbox check all

user7291

function toggle(source) {
  checkboxes = document.getElementsByName('foo');
  for(var i=0, n=checkboxes.length;i<n;i++) {
    checkboxes[i].checked = source.checked;
  }
}