Javascript 克隆的下拉列表不适用于jQuery统一主题
好的,我再次遇到jQuery统一主题的问题。我正在使用文本输入、下拉列表和按钮克隆行,以添加(克隆)或删除行。问题是,一旦我克隆了一行,您就无法更改新行上的下拉选择。如果我禁用统一函数,它就会工作Javascript 克隆的下拉列表不适用于jQuery统一主题,javascript,jquery,drop-down-menu,clone,uniform,Javascript,Jquery,Drop Down Menu,Clone,Uniform,好的,我再次遇到jQuery统一主题的问题。我正在使用文本输入、下拉列表和按钮克隆行,以添加(克隆)或删除行。问题是,一旦我克隆了一行,您就无法更改新行上的下拉选择。如果我禁用统一函数,它就会工作 <!---<script type="text/javascript" charset="utf-8"> $(function(){ $("input:text, input:file, select, textarea, input:button").uniform()
<!---<script type="text/javascript" charset="utf-8">
$(function(){
$("input:text, input:file, select, textarea, input:button").uniform();
});
</script>--->
这是我的密码。统一更新似乎也不起作用
//
id=0;
$("table#customers_tab img.remove").live("click", function (event) {
$(this).parents("tr").remove();
var remove_id = event.target.id;
var index = remove_id.substring(6);
var table = document.getElementById("customers_tab");
for(var i=parseInt(index); i<table.rows.length;i++){
$($('table#customers_tab tr')[i]).find("img.add").attr("id","add"+i);
$($('table#customers_tab tr')[i]).find("img.remove").attr("id","remove"+i);
}
});
$("table#customers_tab img.add").live("click", function (event) {
id++;
var master = $(this).parents("table#customers_tab");
var add_id = event.target.id;
var index = add_id.substring(3);
var prot = $($('table#customers_tab tr')[index]).clone();
var incr = parseInt(index)+1;
prot.find("img.add").attr("id","add"+incr);
$('.feature').live('change',function(){ ////SOLUTION HERE
$.uniform.update("select"); ////
}); ////
$($('table#customers_tab tr')[index]).after(prot);
var table = document.getElementById("customers_tab");
for(var i=incr+1; i<table.rows.length;i++){
$($('table#customers_tab tr')[i]).find("img.add").attr("id","add"+i);
$($('table#customers_tab tr')[i]).find("img.remove").attr("id","remove"+i);
}
$.uniform.update(); //NOT WORKING
});
$("#delAllCustomers").live("click", function (event) {
$("#customers_tab").children().remove();
});
//
//
id=0;
$(“表#客户_选项卡img.remove”).live(“单击”,功能(事件){
$(this.parents(“tr”).remove();
var remove_id=event.target.id;
var索引=删除子字符串(6);
var table=document.getElementById(“客户”选项卡);
对于(var i=parseInt(index);i您必须将统一添加到那些特定的新元素中。如果您将统一添加到元素中,然后将其再次添加到将中断的同一元素中。您想尝试以下操作:
$("#newID1 input:text, #newID2 input:file, #newID3 select, #newID4 textarea, #newID5 input:button").uniform();
或者只是:
$("#newID select").uniform();
好的,上面的代码现在可以工作了。我编辑了它,但是谢谢你的输入。:D