Sum columns (Must know)
This section shows us how to use jQuery to create an array of cells that make up a table column, add the values together, and display the total in the bottom-row.
Getting ready
You will need a simple HTML table (this will be a recurring theme under each Getting ready section). Make sure your table has a <tfoot>
section with one row, which will hold the sums. Make sure your table has a <tfoot>
section with one row, which will hold the sums.
How to do it...
- Once again, give the table an
id
attribute. The table should have a column of numeric values that can be added together.<table border="1" id="populationTable">
- Add a
thead
and ...
Get Instant jQuery 2.0 Table Manipulation How-to now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.