samedi 17 octobre 2015

check all checkboxes that are not checked

I have a column of dynamically created checkboxes. I have a check all checkbox at the top in the th. I need to check all the checkboxes Except the ones that are already checked.

<input type="checkbox" class="checkAll" />
<input name=""rowBox type="checkbox" class="row checkbox" value="1" checked />
<input name=""rowBox type="checkbox" class="row checkbox" />
<input name=""rowBox type="checkbox" class="row checkbox" />

$('input.checkAll' ).on('click', function(){


$('input[name="name=""rowBox"]' ).prop('checked', this.checked)
  })

This works to check all the checkboxes, but it unchecks the ones that are checked on page load initially.




Aucun commentaire:

Enregistrer un commentaire