我有以下代碼:計算總價jQuery中
for(i=0;i<data.length;i++){
// alert(data[i].stock_id);
html1 += '<tr>\n\
<td><input type="text" style="width:80px !important;" readonly id="patient_name' + i + '" name="patient_name[]" value="'+data[i].patient_name+'"/></td>\n\
<td><input type="text" style="width:80px !important;" readonly class="SmallInput" id="description' + i + '" name="description[]" value="'+data[i].description+'"/></td>\n\\n\n\
<td><input type="text" style="width:80px !important;" readonly class="SmallInput" id="amount' + i + '" name="amount[]" value="'+data[i].amount+'"/></td>\n\
<td><input type="text" style="width:80px !important;" readonly class="SmallInput" id="qauntity' + i + '" name="quantity[]" value="'+data[i].quantity+'"/></td>\n\
<td><input type="text" style="width:80px !important;" readonly class="SmallInput" id="charged'+i+'" name="charged[]" value="'+data[i].charged+'"></td> \n\
<td><input type="hidden" style="width:80px !important;" readonly class="SmallInput" id="patient_visit_statement_id'+i+'" name="patient_visit_statement_id[]" value="'+data[i].patient_visit_statement_id+'"></td> \n\
<td><input type="hidden" style="width:80px color:red!important ;" readonly class="SmallInput" id="patient_id'+i+'" name="patient_payment_id[]" value="'+data[i].patient_payment_id+'"></td> \n\\n\
<td><input type="hidden" style="width:80px !important;" readonly class="SmallInput" id="patient_id'+i+'" name="patient_id[]" value="'+data[i].patient_id+'"></td> \n\
<td><input type="hidden" style="width:80px color:red!important ;" readonly class="SmallInput" id="visit_id'+i+'" name="visit_id[]" value="'+data[i].visit_id+'"></td> \n\n\
</tr> ';
}
htmlhead1+='\n\
<th style="width:80px !important;" >Patient Name</th>\n\
<th style="width:80px !important;" > Description</th> \n\
<th style="width:80px !important;" > Amount </th> \n\
<th style="width:80px !important;" >Quantity</th> \n\
<th style="width:80px !important;" >Charged? </th> \n \n \n';
$('#tbody1').empty();
$('#tbody1').append(htmlhead1);
$('#tbody1').append(html1);
$('#tbody1').append(total_price);
for循環形式在數據庫值的表格填充的動態列表,我要總結的價值的金額並將其視爲總金額/價格。 如何計算循環中的總量並將其附加到#tbody1?