gpt4 book ai didi

jquery - 返回 "previous function"

转载 作者:行者123 更新时间:2023-12-01 07:29:34 31 4
gpt4 key购买 nike

我有这个脚本:

$('#ap').click(function() {
$('#content-container').html($('#alertpay').html());
return false;
});

每当有人点击#ap时,就会在#content-container中显示#alertpay的内容。

但是,我如何才能创建返回链接,以便当用户单击它时,它将显示 #content-container 中的原始内容? (那里的内容。)

更新我正在尝试使用这段代码:

                    <div align="center" id="content-container">
<a href="#" id="ap">Show #alertpay</a>
</div>

<div id="alertpay" style="display:none">
#alertpay content here.

<a href="#" id="return-link">RETURN</a>

</div>


(function(){
var cchtml;
$('#ap').click(function(){
cchtml = $('#content-container').html();
$('#content-container').html($('#alertpay').html());
return false;
});

$('#return-link').click(function(){
$('#content-container').html(cchtml);
return false;
});
})();

这里不起作用的是当我按下 RETURN anchor 链接时。它没有做任何事情。

最佳答案

最好的选择是拥有三个容器。一开始是空的。根据用户行为选择要显示的内容。

$('#ap').click(function() {
$('#empty-container').html($('#alertpay').html());
return false;
});

$('#revert-ap').click(function() {
$('#empty-container').html($('#content-container').html());
return false;
});

并确保隐藏内容容器和alertpay

关于jquery - 返回 "previous function",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7220047/

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