Check for element to appears in the DOM and do stuff and stop interval
<script>
jQuery(function($){
myVar = setInterval(function() {
if ($('.x-class').length) {
$('.contact-form-home .et-pb-contact-message li:last-child:not(.appearedx)')
.addClass('appearedx')
.each(function() {
$(".appearedx").text('Math Problem');
});
clearInterval(myVar);
}
}, 100)
});
</script>myVar = setInterval("javascript function", milliseconds);
Then you will be able to stop the execution by calling the clearInterval() method.
clearInterval(myVar);
code type:
