I was wondering what is the best method in order to fire an event when all DOM is loaded. In particular, suppose that the HTML page contains a number of AJAX request. Is it enough to use:
window.onload = function() { };
or:
window.addListener("DOMCreated", function() { });
The answer should be "no", since I've tried to use these two functions, but when I try to do document.getElementById("id")
, I always got a null
.
Ah, I cannot use jQuery.