mercredi 29 juillet 2015

Can't check and uncheck checkboxes after first click

In my button click I have some logic that sets checkboxes to checked/unchecked

It works after the first check but after that it doesn't check any of the checkboxes. The button text still changes on each click but not the checkboxes

Here is my logic in the click event

var buttonText = $('button.btn.btn-default.check-all').text();
if (buttonText == "Check All") {
  $('button.btn.btn-default.check-all').text('Uncheck All');
  $('#Users').find(":checkbox").attr("checked", true);
} else {
  $('button.btn.btn-default.check-all').text('Check All')
  $('#Users').find(":checkbox").attr("checked", false);
}



Aucun commentaire:

Enregistrer un commentaire