JavaScript
Article

The Document Ready Function

By Sam Deering

The jQuery document ready function is used as an outer container for all of your jQuery functions and event code. It’s purpose is that it only loads the jQuery code once your HTML has fully loaded in the webpage. This allows it to add functions and events to HTML objects held within the DOM and prevent loading errors.

This is how you do it:

$(document).ready(function(){

 // jQuery functions go here...

 });

Source: http://www.w3schools.com/jquery/jquery_syntax.asp

No Reader comments

Recommended

Learn Coding Online
Learn Web Development

Start learning web development and design for free with SitePoint Premium!

Get the latest in JavaScript, once a week, for free.