ボックスをチェックすると、同じ行の入力に値が入力されるという要件があります。
私のコードは次のとおりです。
function populatetransportprice() {
// iterate through the "checked" checkboxes
$("table.authors-list").find('input[type="checkbox"][name^="treated"]:checked').each(function () {
alert(treatedtransportcostperton);
row.find('input[name^="transportprice"]').val(treatedtransportcostperton.toFixed(2));
});
}
各行の入力フィールドはtranpsortpriceX
、X が行番号です。
私のHTMLは:
<table class="authors-list" id="ordertable">
<tr>
<td><input name="transportprice1" id="transportprice1" class="rounded"></td>
</tr>
<tr>
<td><input name="transportprice2" id="transportprice2" class="rounded"></td>
</tr>
<tr>
<td><input name="transportprice3" id="transportprice3" class="rounded"></td>
</tr>
</table>
テーブルのチェックボックスごとにアラートが入力されますが、入力は入力されません。私はそれが私のrow.find
.
アドバイスをいただければ幸いです、ありがとう
アップデート
現在の構文:
function populatetransportprice() {
$("table.authors-list").find('input[type="checkbox"][name^="treated"]:checked').each(function () {
$(this).find('input[name^="transportprice"]').val(treatedtransportcostperton.toFixed(2));
$(this).next('input[name^="transportprice"]').val(treatedtransportcostperton.toFixed(2));
});
}