Check checkbox

by johnweland

HTML

<input type="checkbox" name="group1" checked /> 1
<input type="checkbox" name="group1" /> 2

<input type="checkbox" name="group2" checked /> A
<input type="checkbox" name="group2" /> B

JavaScript

$('input[type="checkbox"][name="group1"]').on('change', function() {
	$('input[type="checkbox"][name="group1"]').not(this).prop('checked', ! this.checked);
});