这是我的 HTML 片段
<td id = "bank2.loan1">
<form:input path="bankDetails[1].EMIofRunningLoan1" size = "12" id = "bankDetails1_EMIofRunningLoan1" cssClass = "emi"/>
</td>
<th id = "bank2.loanText2">
Running Loan 2
</th>
<td id = "bank2.loan2">
<form:input path="bankDetails[1].EMIofRunningLoan2" size = "12" id = "bankDetails1_EMIofRunningLoan2" cssClass = "emi"/>
</td>
<th id = "bank2.loanText3">
Running Loan 3
</th>
<td id = "bank2.loan3">
<form:input path="bankDetails[1].EMIofRunningLoan3" size = "12" id = "bankDetails1_EMIofRunningLoan3" cssClass = "emi"/>
</td>
<th id = "bank2.loanText4">
Running Loan 4
</th>
<td id = "bank2.loan4">
<form:input path="bankDetails[1].EMIofRunningLoan4" size = "12" id = "bankDetails1_EMIofRunningLoan4" cssClass = "emi"/>
</td>
</tr>
<tr>
<th id = "bank2.loanText5">
Running Loan 5
</th>
<td id = "bank2.loan5">
<form:input path="bankDetails[1].EMIofRunningLoan5" size = "12" id = "bankDetails1_EMIofRunningLoan5" cssClass = "emi"/>
</td>
<th id = "bank2.loanText6">
Running Loan 6
</th>
<td id = "bank2.loan6">
<form:input path="bankDetails[1].EMIofRunningLoan6" size = "12" id = "bankDetails1_EMIofRunningLoan6" cssClass = "emi"/>
</td>
<th id = "bank2.loanText7">
Running Loan 7
</th>
<td id = "bank2.loan7">
<form:input path="bankDetails[1].EMIofRunningLoan7" size = "12" id = "bankDetails1_EMIofRunningLoan7" cssClass = "emi"/>
</td>
我想将每个具有 class = emi 的元素的值重置为 0.0。看看我的 jQuery 片段。这似乎不起作用。我正在调用函数 resetForm() 。
function resetForm() {
$('.emi').each(function() {
$(this).val('0.0');
});
}