Jクエリ:
$('#partsOrderQty').blur(function(){
var rowCounter = $(this).val();
console.log(rowCounter);
var toAddRow = $("#skidListings").children().clone();
for (var i=0; i<rowCounter; i++) {
$("#skidListings").append(toAddRow);
console.log("Ran Once Just Now");
}
});
html:
<div id="skidListings">
<input class="ConfirmQty" name="ConfirmQty" type="text" value="<?php echo $confirm;?>"/>
<input class="ConfirmDesc" name="ConfirmDesc" type="text" value="<?php echo $des[$final]; ?>"/>
<input class="ConfirmWeight" name="ConfirmWeight" type="text" value="<?php echo $ShipWeight[$final]*$confirm; ?>" />
<input class="ConfirmClass" name="ConfirmClass" type="text" value="<?php echo $class[$final]; ?>"/>
<input class="ConfirmNMFC" name="ConfirmNMFC" type="text" value="<?php echo $NMFC[$final]; ?>"/>
<input class="ConfirmLength" name="ConfirmLength" type="text" value="<?php echo $length[$final]; ?>"/>
<input class="ConfirmWidth" name="ConfirmWidth" type="text" value="<?php echo $width[$final]; ?>" />
<input class="ConfirmHeight" name="ConfirmHeight" type="text" value="<?php echo $height[$final]; ?>" /><br />
</div>
コンソール メッセージは正しい回数出力されるのに、なぜこの複製は 1 回しか行われないのですか? 値をクリアする必要がありますか? この機能は、データベースから取得したものとは異なる数のピースを手動で指定できるようにすることです。ID を使用してクローンを作成できないことは理解していますが、ID を持たない子を選択しました。クラスを保持する必要があります。名前を削除する必要がありますか? それは問題ですか?
編集:リクエストごとにhttp://jsfiddle.net/NxSwA/