开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜