質問

I have a jquery function that removes content and toggles a button on twitter bootstrap and after that button is toggles, if you click it it's suppose to go back to the removes content, but it's not working. Please help. Thank you!

$('#btnAdd').click(function () {
    $(".RemoveSettings").remove();
    $(this).toggleClass('displaying');
    $('#removedcontent').show();
});
$('#removedcontent').click(function () {
    $('#removedcontent').remove();
    $(".RemoveSettings").show();
});
役に立ちましたか?

解決

You are removing elements, you cannot show them if they are removed.

Replace your remove()'s with hide()s instead.

$('#btnAdd').click(function () {
    $(".RemoveSettings").hide();
    $(this).toggleClass('displaying');
    $('#removedcontent').show();
});
$('#removedcontent').click(function () {
    $('#removedcontent').hide();
    $(".RemoveSettings").show();
});
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top