我已經有一個搜索,但還沒有找到任何我想要做的事情。jquery,計算字段總和(動態)
我有一個動態的形式,每個項目有2個輸入框,1是一個值,另一個是數量。 例如
<table class="table table-striped table-condensed table-bordered">
<thead>
<tr>
<th>Item</th>
<th width="20%">Value</th>
<th width="20%">Quantity</th>
<th class="actions">Total</th>
</tr>
</thead>
<tbody>
<tr>
<td>Item</td>
<td><input type="text" class="input-small" name="var_1" value="0"></td>
<td><input type="text" class="input-small" name="var_1_1" value="0"></td>
<td>$<span class="amount"></span> </td>
</tr>
<tr>
<td>Item</td>
<td><input type="text" class="input-small" name="var_2" value="0"></td>
<td><input type="text" class="input-small" name="var_2_2" value="0"></td>
<td>$<span class="amount"></span> </td>
</tr>
<tr>
<td colspan="3"><strong>Total event cost (viability)</strong></td>
<td><strong>$<div class="total_amount">total</div></strong></td>
</tr>
</tbody>
所以我需要計算val_1 X val_1_1 =總然後添加總所有向上末(每個項目)。
我希望我會找到一些可以無限制使用的東西。
你能證明你的HTML? – 2012-03-28 02:31:25
你需要顯示標記以獲得任何有用的答案。 – mikevoermans 2012-03-28 02:31:28