Question

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();
});
Was it helpful?

Solution

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();
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top