divに続いてクローンを作成していますが、すべてのクローンにnewidを作成したいと思います。そしてそれはそのようにやっていますが、それはdivを別々に作成し、入力を別々のoutsidedivとすべてのデザインmessupとして作成しています。次のdiv_cloneを使用して、すべての入力を他のdivコンテナに表示する必要があります。
HTML
<div id="div_" style="display: none;" class="well form-inline">
<label>Label :</label> <input type="text" id="txtlabel" name="txtlabel" />
<label>value :</label> <input type="text" id="txtvalue" name="txtvalue" />
<label>Selected :</label> <input type="checkbox" name="chk_sel" value="chk_sel" />
<label>Required :</label> <input type="checkbox" name="chk_isreq" value="chk_isreq" />
</div>
jQuery
var = question_cnt=1;
$("#div_").clone().find("input,label").andSelf().each(function() {
$(this).show();
$(this).attr('id', this.id +question_cnt );
$(this).attr('name', this.name +question_cnt );
}).appendTo("#container").end();
question_cnt++;