December 2013
Intermediate to advanced
384 pages
9h 54m
English
$(document).ready(function(){ (initialization code here...) } or $(document).load(function(){ (initialization code here...) }
In jQuery, you can trigger and execute initialization code at two different times: when the DOM is ready, and when the document and its resources have fully loaded. The option to use depends on what needs to happen in your initialization code.
Using the .ready() jQuery method triggers the initialization code to run when the DOM is fully ready. All the DOM objects will be created, and the page will be displayed to users. Note that not all page resources, such as images, may have fully downloaded at this point. This is the option that I use most frequently ...
Read now
Unlock full access