I'm fairly new in jQuery. Basically I have a few tables and I have to make last checkbox for each table checked when all of the elements of a table are checked. Here is a simple demo that is the result that I want.
Demo: Fiddle
So far this is what I did, but it still checked for my last checkbox although the elements of that field are not checked all of them.
$('table tr:last-child input:checkbox').closest('table').find('input:checkbox').each(function() {
if ($(this).is(":checked")) {
$('table tr:last-child input:checkbox').prop('checked',true);
}
});
Aucun commentaire:
Enregistrer un commentaire