我想计算价格*数量的摘要怎么做?
表 1:单击添加以在表 2 中创建详细信息
<table width="60%" border="1">
<tr>
<td align="center">menu</td>
<td align="center">quantity</td>
<td align="center">price</td>
<td> </td>
</tr>
<tr id="workplace-view-menu">
<td id="workplace-menu">coffee</td>
<td id="workplace-number">5</td>
<td id="workplace-price">50</td>
<td align="center"><input type="button" value="add" id="workplace-submit" name="workplace-submit" class="btn-green">
</td>
</tr>
<tr id="workplace-view-menu">
<td id="workplace-menu">food</td>
<td id="workplace-number">2</td>
<td id="workplace-price">70</td>
<td align="center"><input type="button" value="add" id="workplace-submit" name="workplace-submit" class="btn-green">
</td>
</tr>
</table>
表 2:jquery 创建元素并计算 td class='ordernumber' * td class='order-price' 中的值
<table width="200" border="1" id="order-detial">
<tr>
<td>menu</td>
<td>quantity</td>
<td>price</td>
<td></td>
</tr>
</table>
<div id="calculator"></div>
查询:
$(document).ready(function(){
$('#workplace-submit').click(function(){
var menu=$('#workplace-menu-name').val();
var number=$('#workplace-number').val();
var price=$('td#workplace-price').text();
$('#order-detial').append('<tr class="order-detials"><td>'+menu+'</td><td class="order-number">'+number+'</td><td class="order-price">'+price+'</td><td><button class="btn-green" onclick="OrderRemove(this)">delete</button></td></tr>');
OrderRemove = function(el) {
$(el).parents("tr").remove();
}
});