Jquery.show按钮获胜'不起作用

Jquery .show button won't work

本文关键字:不起作用 获胜 show 按钮 Jquery      更新时间:2023-09-26

我有一个jquery函数,它可以删除内容并切换twitter引导程序上的一个按钮,在切换该按钮后,如果单击它,它将返回到删除内容,但它不起作用。请帮忙。非常感谢。

$('#btnAdd').click(function () {
    $(".RemoveSettings").remove();
    $(this).toggleClass('displaying');
    $('#removedcontent').show();
});
$('#removedcontent').click(function () {
    $('#removedcontent').remove();
    $(".RemoveSettings").show();
});

您正在删除元素,如果已删除,则无法显示它们。

将您的remove()替换为hide()

$('#btnAdd').click(function () {
    $(".RemoveSettings").hide();
    $(this).toggleClass('displaying');
    $('#removedcontent').show();
});
$('#removedcontent').click(function () {
    $('#removedcontent').hide();
    $(".RemoveSettings").show();
});