Jquery ms下拉选择框与添加/删除TR表格选择框集成';不行,
我的选择框有问题。我使用ms下拉菜单并将其与我的添加/删除表行集成。 下面是整个jquery脚本Jquery ms下拉选择框与添加/删除TR表格选择框集成';不行,,jquery,drop-down-menu,jquery-selectbox,msdropdown,Jquery,Drop Down Menu,Jquery Selectbox,Msdropdown,我的选择框有问题。我使用ms下拉菜单并将其与我的添加/删除表行集成。 下面是整个jquery脚本 $(document).ready(function() { var id = 0; var n = 0; // Add button functionality $("table.dynatable button.add").click(function(e) { e.preventD
$(document).ready(function() {
var id = 0;
var n = 0;
// Add button functionality
$("table.dynatable button.add").click(function(e) {
e.preventDefault();
id++;
n++;
var master = $(this).parents("table.dynatable");
// Get a new row based on the prototype row
var prot = master.find(".prototype").clone();
prot.attr("class", "")
prot.find(".id").attr("value", id);
prot.find(".num").html(n);
master.find("tbody").append(prot);
});
// Remove button functionality
$("table.dynatable button.remove").live("click", function() {
$(this).closest("tr").remove();
});
$(".tech").msDropdown();
});
这是桌子
<table class="dynatable" align='center' id='dynatable' border='1'>
<thead>
<tr>
<th width='500px' colspan='2'>Window Type</th>
<th><button class="add">Add</button></th>
</tr>
</thead>
<tbody>
<tr class="prototype">
<td width='5px'>
<span class='num'>1</span>
</td>
<td>
<input type="checkbox" name="checkbox[]" value="0" class="id" id='checkbox' style='display:none;' checked/>
<select name='prod_type[]' class='tech' style='width:300px;'>
<option value='' data-description="Select Window/Door"></option><option value='Sample1' data-image="" data-description="This is sample 1">
Sample 1
</option><option value='Sample2' data-image="" data-description="This is sample 2">
Sample 2
</option><option value='Sample 3' data-image="" data-description="This is sample 3">
Sample 3
</select>
</td>
<td>
<button class="remove">X</button>
</td>
</tr>
</table>
窗口类型
添加
1.
样本1
样本2
样本3
X
问题是,当您单击“添加”按钮时,它将追加一行,但“选择”框似乎已禁用。我想知道为什么会这样。。请帮帮我。。提前谢谢
这是小提琴:
嗨,我看到了你的代码。。。。还有这个问题 请参阅此以查看已解决的代码 要解决此问题,您只需在HTML代码中替换下一行即可
<input type="checkbox" name="checkbox[]" value="0" class="id" id='checkbox' style='display:none;' checked/>
使用此代码行
<input type="checkbox" name="checkbox[]" value="0" class="id" id='checkbox' checked/>
您只需删除您的
style='display:none'
:D仍不工作。我这里的问题是,如果我单击add按钮,TR将添加,同时选择框也会工作。