wetfeet
Thu, 12 Oct 2017 09:07:22 GMT
I am using some AJAX through `$$.get( ... )` to dynamically pull in HTML fragments from external files to build up the body. Calling `myApp.init()` before the AJAX loads finish seems not to initialize all the DOM elements properly (e.g. some components do not render properly or behave properly when clicked etc.). I believe the AJAX XHR loading is asynchronous and myApp.init() is being called before all the necessary parts have been added to DOM.
So I delayed calling `myApp.init()` using:
```
document.addEventListener(
"DOMContentLoaded",
function(){
myApp.init();
},
false
);
```
Well, still the same problem. Any idea if it must be called before *DOMContentLoaded* event?