i have a code like this :
$("#checkAll").change(function () {
$("input:checkbox").prop('checked', $(this).prop("checked"));
});
this code it's work, if i click checkbox #checkall
, it's check all checkbox
, if i uncheck #checkall
, it's uncheck all checkbox
.
The first problem is if i check #checkall
, it's check all checkbox
, but when i uncheck one of checkbox
that's #checkall
still checked, actually it's not checked because one of checkbox
is unchecked and automatically not checked all.
Second is if i manually check all one by one checkbox
, the #checkall
not checked, actually the checked is checked all.
how to solve this?
Aucun commentaire:
Enregistrer un commentaire