What Exactly Does $(document).ready Guarantee?
Running my (rather complex) JavaScript/jQuery application in Google's Chrome browser, it would appear that $(document).ready fires while some of the JavaScript files have not yet l
Solution 1:
The document's ready event is fired when the browser has parsed the HTML file from beginning to end and converted it into a DOM structure. It does not in any way guarantee that any other resources (e.g. stylesheets, images or, as in this case, scripts) will have loaded. It only refers to the DOM structure, and is fired irrespective of the loading status of the page's resources.
If you want to wait for resources to load, use the window
's load
event, which is fired only when every element on the page has finished loading.
See:
Post a Comment for "What Exactly Does $(document).ready Guarantee?"