How to Add values in a table together using jQuery?
I have an HTML table with number values. What I need to do is to get all these values and add them together using jQuery. Any ideas? Example table: http://pastie.org/998759 You can call .each : var sum = 0; $('table td').each(function() { sum += parseFloat($(this).text()); }); I'm going to give you some pseudo-code of how I would do it (mainly because I can't be stuffed writing the whole thing). Create an object/array/variables to store the totals. jQuery select the table Use .each() to loop through each tr . Loop each td and add the value to the relevant total. Once all of the tr have been