It sounds as if this might be a good candidate for my Calculation plug-in: http://www.pengoworks.com/workshop/jquery/calculation.plugin.htm
$("tr").each(function (){ var sum = $("span.length", this).sum(); var person = $("td.person").text(); alert(person + " = " + sum); }); -Dan >-----Original Message----- >From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On >Behalf Of pedalpete >Sent: Tuesday, January 22, 2008 10:13 PM >To: jQuery (English) >Subject: [jQuery] Re: sum of table rows > > >I'm not sure if I am getting closer on this or further away. > >I have a table that looks like this >[code] ><table> > <tr id=newPerson> > <td class="person">first person</td> > <td class="date"><div class="input"><span class="length>8</ >span></div></td> > <td class="date"><div class="input"><span class="length>8</ >span></div></td> > <td class="date"><div class="input"><span class="length>8</ >span></div></td> > </tr> > <tr id=newPerson> > <td class="person">second person</td> > <td class="date"><div class="input"><span class="length>8</ >span></div></td> > <td class="date"><div class="input"><span class="length>8</ >span></div></td> > <td class="date"><div class="input"><span class="length>8</ >span></div></td> > </tr> > <tr id=newPerson> > <td class="person">third person</td> > <td class="date"><div class="input"><span class="length>8</ >span></div></td> > <td class="date"><div class="input"><span class="length>8</ >span></div></td> > <td class="date"><div class="input"><span class="length>8</ >span></div></td> > </tr> ></table> >[/code] > >and i am trying to get the sum of the content of the .length values >for each person seperately. > >I have now got this, but I don't seem to be getting anywhere, now I'm >not even able to get the values. >Am I not going about getting the lengths properly? > >[code] >var start = 0; > var totalLength = parseInt(start); > ("#newPerson").click(function(event){ > var $newPerson = $("#newPerson").children( function(){ > var len = $newPerson.each(".shift").id; > alert(len); > }); > }); >[/code] > >