0
:插件 主页:Link。JQuery:计算插件不计算总价
:JavaScript的
$("[id^=total_price_ht]").calc(
// the equation to use for the calculation
"qty * price",
{
qty: $("[id^=unit_quantity_]"),
price: $("[id^=unit_price_ht_]")
},
function (s){
// return the number as a dollar amount
return "$" + s.toFixed(2);
}
);
:HTML
<tr id="lines[0]">
<td>
<input id="0" type="checkbox" class="hiddenCheckbox">
<label for="0" class="prettyCheckbox checkbox list"><span class="holderWrap" style="width: 18px; height: 19px; "><span class="holder" style="width: 18px; "></span></span></label>
</td>
<td>
<input class="required" name="lines[0][title]" placeholder="Title" type="text">
</td>
<td>
<input name="lines[0][description]" placeholder="Description" type="text">
</td>
<td>
<input class="required" id="unit_quantity_0" name="lines[0][quantity]" placeholder="Quantité" type="text" value="0,00">
</td>
<td>
<input class="required" id="unit_price_ht_0" name="lines[0][unit_price_ht]" placeholder="Prix unit. HT" type="text" value="0,00">
</td>
<td class="price" id="total_price_ht_0">$0.00</td>
</tr>
一旦页面加载,我可以看到“$ 0.00" 在total_price_ht领域,但它的价值没有得到时变我更改数量或价格
我在做什么错?谢谢。
你能发布生成的HTML? – 2012-02-24 14:54:30
@AndrewWhitaker我发布了生成的HTML。谢谢。 – Laura 2012-02-24 14:59:22
谢谢 - 这是你使用的插件吗? http://www.pengoworks.com/workshop/jquery/calculation/calculation.plugin.htm – 2012-02-24 15:00:20