Hello im trying to append and remove a css class depending on what value is in the div
if the value is equal to custom now i add a class that removes the :after appended to my text.
I want to reapply the class if it otherwise.
setInterval(function() {
$('.monthappend').each(function() {
var text = $(this).text();
$(this).text(text.replace('$0', 'CUSTOM'));
if ($(this).text() == 'CUSTOM') {
$('.monthappend').addClass('without-after-element');
} else {
$('.monthappend').removeClass('without-after-element');
}
});
}, 1000);
this else statement didnt work... i tried adding another interval check after this one
<script>
setInterval(function() {
$('.monthappend').each(function() {
if ($(this).text() != 'CUSTOM') {
$('.monthappend').removeClass('without-after-element');
}
});
}, 2000);
</script>
but this just caused the appended text to appear and reappear in a loop.
Please help!
site im working this code on https://staging-homecarepulse.kinsta.cloud/pricing-calc-2/