My requirement is, I have to execute a script after all the page scripts execution is done. I am using the below code to do the same
$(window).load(function ()
{
var j = setTimeout (function ()
{
alert("All page scripts have been executed and DOM is ready.");
// And here the script will work
to update the DOM changes made by the pagescripts.
},100); // Here execution time cant be less than 100 all the time, right?
});
But the problem is, In the above case I have used time 100. But sometimes the page is being loaded in 101 milliseconds. In such cases the script is failed to update the changes. Lets see an example for this
There is a page script which will add images to the DOM when DOM is ready. And if I use
$(document).ready()
the script is failed to detect images as the images are not yet added to the DOM.
Please let me know if you need some more clarification on Question.