mismatched {}
you forgot to add brace({
) .click(function () {
$('#product-effect-table input[type=checkbox]').click(function () {
if ($('#product-effect-table input[type=checkbox]').length == $('#product-effect-table input[type=checkbox]:checked').length) {
$("#selectall").attr("checked", "checked");
} else {
$("#selectall").removeAttr("checked");
}
});
Suggested By roasted
.prop() is preferred over .attr()
so you can make use of .prop()
instead of .attr()
like this :-
.prop('checked',true)
and .prop('checked',false)