Hi I am trying for hours now to remove a text string again after I have appended it.
I have a script that handles an accordion and I have some redundancy in text in
Ok, I tried a different approach now:
var redundantText = " text text text Contact Me text text text";
$('#collapse_1').on('show.bs.collapse', function() {
$(".dropdown_collapse_1").addClass("dropdown-indicator");
$(".dropdown_collapse_1").removeClass("dropdown-collapsed");
$("#redundant_text_wrapper").after(redundantText);
});
$('#collapse_1').on('hide.bs.collapse', function() {
$(".dropdown_collapse_1").addClass("dropdown-collapsed");
$(".dropdown_collapse_1").removeClass("dropdown-indicator");
$('#redundantText_wrapper').remove();
});
So basically I use 'after' instead of 'append' and put the text into a span with ID. Now I can use $('#ID').remove(); to get rid of it on closing the tab.