簡體   English   中英

刪除克隆的jQuery UI按鈕將刪除基本按鈕的樣式

[英]Removing cloned jQuery UI button will remove base button's style

我已經為您設置了該提琴: http : //jsfiddle.net/MNpRh/4/

$("#removebtn").button();
$(document).on("click", ".remove", function(){
   $(this).remove();
});
$("#clone").click(function(){
   $("#removebtn").parents(".group").clone(true).appendTo("#content");
});

點擊克隆幾次,然后刪除任何按鈕。 按鈕樣式將被刪除,不會再次克隆。

它基於jQuery UI 1.8。 它可以在1.10中運行,但是我無法升級jQuery UI。

您將如何解決?

提前致謝!

為了保持懸停效果,請參見CSS模式http://jsfiddle.net/MNpRh/8/隱藏的帶有模式div的修改后解決方案

除了HTML:

<div class="group" id="pattern">
     <button class="remove">Remove me</button>
</div>

CSS:

#pattern { display:none;}

JQuery的:

$("#removebtn").button();
$(document).on("click", ".remove", function(){
    $(this).remove();
});
$("#clone").click(function(){
  $('#pattern').clone().appendTo("#content").removeAttr('id').find('button').button();
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM