Inside the page, I have third-party ad content that is generated by an external script. This content takes a little time to download. I would like to remove a line break from the advertising content - to do this, wait until the external script loads, and all the functions called inside this script stop working. I was looking for the following idea, but I think it only waits for the external script to load:
$.getScript( "http://www.external_site.com/widget.js").done( function(data, textStatus, jqxhr) {
$('.result').find('br').remove();
});
What is the best way to wait for an external script to do all its DOM manipulations before calling the .remove () function?
source
share