$('table tfoot td').each(function(index) {
var total = 0;
$('tbody tr').each(function() {
total += +$('td', this).eq(index).text(); //+ will convert string to number
});
$(this).text(total);
})
2
3
4
7
1
2
32
58
4
Update: for dynamic total row.
var totalRow = '', columnNo = $('table tr:first td').length;
for (var index = 0; index < columnNo; index++) {
var total = 0;
$('table tr').each(function () {
total += +$('td', this).eq(index).text(); //+ will convert string to number
});
totalRow += '