我有下面的表格,当我按下第一个按钮时,我调用一个jQuery来克隆第一行并添加一个新行。jquery克隆组合框无法正常工作
<table id='vehReg' class='table table-striped table-bordered bootstrap-datatable' style='font-size:10px;table-layout: fixed;'>
<thead>
<tr>
<th style='width: 10%;'>No.</th>
<th style='width: 30%;'>Sel</th>
<th style='width: 20%;'>Desc.</th>
<th style='width: 18%;'><input type= 'button' value='Add Row' id='addRow()' />
<input type='hidden' value='0' id='totalRows' name='totalRows' /></th>
</tr>
</thead>
<tbody>
<tr>
<td>
1
</td>
<td>
<select class='sSelect' data-rel='chosen' style='font-size:10px;max-width:80%;'>
</select>
<br\><p style='color:#FF0000;' type='text' class='srror' ></p>
</td>
<td>
<input style='font-size:10px;max-width:80%;' class='descInput' type='text' id='desc' name='desc' ><p style='color:#FF0000;' type='text' class='descError' ></p>
</td>
<td>
</td>
</tr>
</tbody>
下面是我的克隆的jquery。它很好地克隆了现在的问题是,一旦它克隆我的选择无法再工作。我只是不能选择组合框。任何调整是必要的我正在使用数据rel的组合框的引导类型,以提供在其中搜索的选项。
$("#addRow").click(function(){
var count = $("#vehReg tr").length;
var $clone = $("#vehReg tbody tr:first").clone();
$clone.attr({
id: "emlRow_" + count,
name: "emlRow_" + count,
style: "" // remove "display:none"
});
$clone.find("input,select").each(function(){
$(this).attr({
id: $(this).attr("id") + count,
name: $(this).attr("name") + count
});
});
$("#vehReg tbody").append($clone);
});
你有任何链接来显示你正在使用哪个引导组合框? –
你使用组合框的任何插件 –
_一旦它克隆我的选择不能工作more_ =>不是很清楚这意味着什么。创建一个复制问题的小提琴。 – lshettyl