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]