문제

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