gpt4 book ai didi

javascript - 如何在使用 jQuery 删除后返回某些内容

转载 作者:行者123 更新时间:2023-11-30 12:40:15 25 4
gpt4 key购买 nike

我在 jQuery 中使用 $(selector).remove(); 来删除一些元素,并希望在我删除它们之后能够返回它们。

当它们被移除后,我该如何归还它们?

我的代码:

$("#cir1").click(function(){
$("#cir2").fadeOut(100);
$("#cir2").remove();
$("#con2").fadeOut(100);
$("#cir3").fadeOut(100);
$("#cir3").remove();
$("#con3").fadeOut(100);
$("#cir4").fadeOut(100);
$("#cir4").remove();
$("#con4").fadeOut(100);
$("#cir1").animate({
width:'590px',
height:'590px',
borderRadius:'800px',
left:'-2px',
top:'-3.5px',
});
$(".matt").fadeOut(100);
$("#con1").fadeOut(100);
$("#abcon").fadeIn(300);
});
$("#back").mouseenter(function(){
$("#cir1").animate({
width:'195px',
height:'195px',
borderRadius:'100px',
});

$(".matt").fadeIn(100);
$("#abcon").fadeOut(300);
$("#cir2").fadeIn(100);
$("#cir3").fadeIn(100);
$("#cir4").fadeIn(100);
});

最佳答案

您可以使用 jQuery 的 detach()相反。

var element = $("#cir3").detach();

// stuff

element.appendTo('#something');

关于javascript - 如何在使用 jQuery 删除后返回某些内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24714122/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com