我正在使用车把来显示该值。选中复选框后,隐藏输入无法定义是否选中该复选框。我的问题是:如何通过发票和总金额" ID"同时到另一页,因为我需要在付款页面上显示所选的发票。那么你能为此推荐一个解决方案吗?
我在下面提供了截图和我的代码。
<table data-role="table" id="tblInvoice" data-filter="true" data-input="#filterTable-input" class="table-stroke table-stripe ui-responsive"><!--without cellpadding-->
<thead>
<tr>
<th colspan="8" style="text-align:center;font-size:20pt;">Open Invoices</th>
</tr>
<tr>
<th width="10%"><input type="checkbox" id="check_all"/></th>
<th>Company_code</th>
<th>Invoice No.</th>
<th>Invoice Type</th>
<th>Invoice Date</th>
<th>Due Date</th>
<th>Invoice Status</th>
<th>Open Amount</th>
</tr>
</thead>
<tbody>
{{#if invoices}}
{{#invoices}}
<tr>
<td>
<input name="selected_open[]" id="checkInvoice" value="{{open_amount}}" style="display:{{display}};" type="checkbox" />
<input name="selected_invoice_no[]" id="checkamount" value="{{invoice_no}}" type="hidden"/>
</td>
<td style="white-space:nowrap;" name="company_code">{{company_code}}</td>
<td style="white-space:nowrap;" name="invoice_no">{{invoice_no}}</td>
<td style="white-space:nowrap;" name="invoice_type">{{invoice_type}}</td>
<td style="white-space:nowrap;" name="invoice_date">{{invoice_date}}</td>
<td style="white-space:nowrap;" name="due_date">{{due_date}}</td>
<td style="white-space:nowrap;" name="status"><font color="{{color}}">{{status}}</font></td>
<td style="white-space:nowrap;" name="open_amount">{{open_amount}}</td>
</tr>
{{/invoices}}
{{else}}
<tr>
<th colspan="7"><div style="font-style:italic; color:red; text-align:center;">No Open Invoice</div></th>
</tr>
{{/if}}
</tbody>
</table>
jquery table(handlebar)
var $cbs = $('input[name="selected_open[]"]');
function calcUsage()
{
var total = 0;
$cbs.each(function() {
if (this.checked)
{
total += parseInt(this.value);
}
});
$("#select_total").text('MYR' + total);//select_total = total amount ID
}
//For checkboxes
$cbs.click(calcUsage);
计算和的函数