1

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

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

1 回答 1

2

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

用 s 代替你remove()的 's hide()

$('#btnAdd').click(function () {
    $(".RemoveSettings").hide();
    $(this).toggleClass('displaying');
    $('#removedcontent').show();
});
$('#removedcontent').click(function () {
    $('#removedcontent').hide();
    $(".RemoveSettings").show();
});
于 2013-08-16T01:20:55.273 回答