I want to get the sum total of check box for each row in a table
Javascript : For Sum
$('input[type="checkbox"]').change(function()
{
var total = 0;
$('#mytable tr').each(function()
{
total += parseInt($(this).val());
$(this).parents('tr').find('input[type=text]:last').val(total);
});
});
Javascript : For Count
$('input[type="checkbox"]').change(function() {
$('#mytable tr').each(function() {
var count = $(this).find(':checkbox:checked').length;
$(this).find('#count').val(count);
});
});
In the First image when i click Select All ,it shows 1 in paper count and 10 in sum column. Then,when i click Select All for second time paper count increase in correct way but no change in sum column.I want to know,How to write for each function . I want to sum the checked checkbox value when selected indiviually and when select by Select All Option
Thanks in Advance
Aucun commentaire:
Enregistrer un commentaire