This blog all about how to sum of particular column values in jQuery. Here you can use the simple .each() function . see the below example for a clear understanding.
jQuery:-
1 2 3 4 5 6 7 8 9 | <script type="text/javascript"> function sumTotal(){ sum =0; $('.price').each(function(){ sum += parseFloat($(this).text()); }); alert(sum); } </script> |
HTML:-
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | <table border="1" width="200px;"> <tr></tr> <td>Price</td> <tr> <td class="price">200</td> </tr> <tr> <td class="price">500</td> </tr> <tr> <td class="price">700</td> </tr> <tr> <td class="price">1000</td> </tr> </table> <button onclick="sumTotal()">SUM</button> |