次のような行を持つテーブルがあります。
<tr>
<th width="30"></th>
<th width="30">Time</th>
<th>Description</th>
</tr>
<tr>
<td><a href="#" class="edit">edit</a></td>
<td class="time">2.50</td>
<td>I did this, and also that, then a little of something else.</td>
</tr>
<tr>
<td><a href="#" class="edit">edit</a></td>
<td class="time">1.50</td>
<td>Another description of time.</td>
</tr>
<tr>
<td><a href="#" class="edit">edit</a></td>
<td class="time">1.50</td>
<td>Yet one more item entered.</td>
</tr>
<tr class="total">
<td><strong>Total:</strong></td>
<td><strong>[calculate total here]</strong></td>
<td> </td>
</tr>
私はjQueryを使用しており、時間を追加するときに発生する関数の一部として、td.timeセルのすべての数値を追加する必要があります。しかし、私の人生では、ループを書くのはあまり得意ではなく、それを理解することはできません。
すべてのtd.timeセルを調べて、数値を合計するためのコードが必要です。合計が取れたら、[ここで合計を計算]スポットに挿入できます。
ありがとう!