 <p>$(document).ready() fires once the DOM is completely loaded and ready for manipulation. This prevents your code from firing before the objects that it'll act against exist. $(document).ready() is the most verbose version of it, and can be replaced up with any of these statements...</p> <pre><code>$(document).ready(handler) $().ready(handler) (this is not recommended) $(handler) $(document).bind("ready", handler) </code></pre> <p>See <a href="http://api.jquery.com/ready/" rel="nofollow noreferrer">here</a> for the documentation. </p>