I've done quite a bit of searching for a solution to this problem but so far haven't found one that works cross browser.
What I need is a raw javascript function which will take an element and run a callback once the innerHTML has successfully been inserted into the dom.
e.g.
var element = document.getElementById('example');
element.innerHTML = newhtml;
waitUntilReady(element, function(){
//do stuff here...
});
So just to summarize, I need to be able to check the contents of the element and fire a callback when innerHTML has completed.
Thanks in advance for any help.
There is no need for such a function. Assigning to innerHTML
will do so immediately before continuing to run any scripts.
If you really need to delay execution (say to allow the browser to redraw), use setTimeout
with a delay of 1
(or other short interval).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With