0
我想要做的是將ddl轉換爲無序列表並刪除第一個子元素。這是偉大的工作,當我只有1 DDL轉換..jquery克隆每個不按預期工作
這是我的代碼:
var rep = jQuery(".input-box select")
.clone()
.find("option:first")
.remove().end()
.wrap("<div></div>")
.parent().html()
.replace(/select/g,"ul")
.replace(/option/g,"li");
jQuery(".price-info").append(rep);
當我有多個DDL \ s到克隆,沒什麼work..i已經修改了上面這一個:
var rep = jQuery(".input-box select");
rep.each(function(){
jQuery(this)
.clone()
.find("option:first")
.remove().end()
.wrap("<div></div>")
.parent().html()
.replace(/select/g,"ul")
.replace(/option/g,"li");
});
jQuery(".price-info").append(rep);
我不知道是否有與每一個問題,還是其他什麼東西..
請幫助..
邏輯您的代碼應在克隆的第二個索引fine..but的工作文字有沒有利的。只是一個空的UL。第一個克隆顯示效果很好 –
如果我刪除(.find(option:first).remove()。end()),您可以共享html樣本 –
。也許這一點需要重新編寫,你覺得怎麼樣? –