嗨,我已經從前一篇文章修復了此表單。使用jquery更新當前行中的值
<form id="eForm" action="">
<table class="fMain" border="1" cellpadding="0" cellspacing="0">
<tbody>
<tr class="ist">
<td>In work</td>
<td>09/25/2013</td>
<td><input type="text" value="3500.00" name="salesS" class="totalS fo" readonly=""></td>
<td ><input type="text" value="23.00" name="cusS" class="cusS form-field-tiny readonly" readonly=""></td>
<td>0.66%</td>
</tr>
<tr class="ist">
<td>In work</td>
<td>09/25/2013</td>
<td><input type="text" value="2445.00" name="salesS" class="totalS fo" readonly=""></td>
<td ><input type="text" value="444.00" name="cusS" class="cusS form-field-tiny readonly" readonly=""></td>
<td>0.66%</td>
</tr>
</tbody>
</table>
</form>
我正在使用以下jQuery做一些格式。
$('.eForm tr.ist').each(function() {
var num = $(this).find('#salesS').val();
var cNum = $(this).find('#cusS').val();
alert(num);
alert(cNum);
document.getElementById('salesS').value = pC(num);
document.getElementById('cusS').value = pC(cNum);
});
它工作正常所有的值都處理得很好。但是當它使用 更新這些值時,它不會更新當前行。它只是更新第一行。
document.getElementById('salesS').value = pC(num);
document.getElementById('cusS').value = pC(cNum);
我想這
$(this).find('#cusS').val()=pC(num);
它沒有工作。請讓我知道如何修復它,以便更新當前行中的值。謝謝
難道你不是指'$('#eForm tr.ist')each' – anishthecoder