Traditionally Javascript events were attached to a document using an “onload” attribute in the tag of the page.

The $(document).ready() function takes a function as its argument. (In this case, an anonymous function is created inline—a technique that is used throughout the jQuery documentation.)

Advertisements