How to call a function after jQuery .append
is completely done?
Here\'s an example:
$(\"#root\").append(child, function(){
// Action
Although Marcus Ekwall is absolutely right about the synchronicity of append, I have also found that in odd situations sometimes the DOM isn't completely rendered by the browser when the next line of code runs.
In this scenario then shadowdiver solutions is along the correct lines - with using .ready - however it is a lot tidier to chain the call to your original append.
$('#root')
.append(html)
.ready(function () {
// enter code here
});