may88seiji
9/5/2017 - 10:45 AM

チェックボックスをまとめてチェックする

チェックボックスをまとめてチェックする

$('#check-all').on('change', function() {
  $('input[name="foo"]').prop('checked', this.checked);
});
<input id="check-all" type="checkbox" /> Check All
<input type="checkbox" name="foo" /> Checkbox 1
<input type="checkbox" name="foo" /> Checkbox 2
<input type="checkbox" name="foo" /> Checkbox 3