Adding up Rows with JQuery
Simple and sometimes unnecessary function to add table cells together and populate another with the total. Using jQuery because its easy and it works and we all love it.
$(document).ready(function() {
var x = 0;
$("td.num").each(function() {
x += parseInt($(this).html());
})
$("td#total").html(x);
});
Where your table cells to add up are <td class=”num”> and the table cell that has the total is <td id=”total”>.
Blog Categories
Recent Stuff
Twitter Updates
- RT @stevebiddle 'Why have a sign on your cafe saying "holiday surcharge applies"?' Or "we forgot holidays in our poorly planned business"
- Ahh that's right, this is the Harry Potter where the vampire gets killed at the end
- There's a problem being the social media guinea pig. Your friends aren't there when you sign up.
- @toxaq I thought he'd be taller. And be protected from people like you
- RT @timbray: âPiracy, copyright, profit, and kiss my ass.â http://t.co/Ky2Bi8n7 I think this one worth passing on.


