jquery table rows calculation
Here is table code...
<tr>
<td class="installationcharge">500</td>
<td class="supportcharge">300</td>
<td class="totalcharges">800</td>
</tr>
<tr>
<td class="installationcharge">200</td>
<td class="supportcharge">400</td>
<td class="totalcharges">600</td>
</tr>
<tfoot>
<tr><td>Total :</td>
<td class="totalinstcharges"></td>
<td class="totalsuppcharges"></td>
&l开发者_运维百科t;td class="totalchartotal"></td>
</tr>
</tfoot>
I am trying to calculate and post of all installationcharge, supportcharge, totalcharges in their tfoot total td. I have tried to use jquery each function but no luck, can you help out please. thanks.
var sum1 = 0;
$('.installationcharge').each(function(){
sum1+= parseFloat($(this).html());
});
$('.totalinstcharges').html(sum1);
and for other data in the same way.
精彩评论