Frage

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();
});
War es hilfreich?

Lösung

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();
});
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top