我有一个产品订购单,有不同尺寸可供选择。因此,对于每个产品,每个尺寸都有一个输入,总和位于行的末尾。我现实我有大约 500 行。
<table>
<tr>
<th>Product</th>
<th>Size 1</th>
<th>Size 2</th>
<th>Size 3</th>
<th>TOTAL</th>
</tr>
<tr>
<td>A</td>
<td><input type="text" class="productA"></td>
<td><input type="text" class="productA"></td>
<td><input type="text" class="productA"></td>
<td></td>
</tr>
<tr>
<td>B</td>
<td><input type="text" class="productB"></td>
<td><input type="text" class="productB"></td>
<td><input type="text" class="productB"></td>
<td></td>
</tr>
<tr>
<td>C</td>
<td><input type="text" class="productC"></td>
<td><input type="text" class="productC"></td>
<td><input type="text" class="productC"></td>
<td></td>
</tr>
</table>Run Code Online (Sandbox Code Playgroud)
我尝试了几种方法,但它从来不想工作。我只成功地一次计算了所有输入,而不仅仅是单独计算了一行。
td每次输入更改时,我想计算最后每一行的总和。
有谁知道我如何解决这个问题?