back to Overview

$.ready()

Registers a handler to be called as soon as the HTML has been fully loaded in the browser.
Web module only.

Syntax

$.ready(handler)

Parameters

handler
the function() to be called when the HTML is ready.

Description

Registers a handler to be called as soon as the HTML has been fully loaded in the browser. Does not necessarily wait for images and other elements, only the main HTML document needs to be complete. On older browsers it is the same as window.onload.

If you call ready() after the page is completed, the handler is scheduled for invocation in the event loop as soon as possible.

A shortcut for ready() is to call $() with the handler function. It does the same with fewer characters.

Example

Registers a handler that sets some text in an element:

$.ready(function() {
  $('#someElement').fill('ready() called');
});

See also..

  • $() calls ready() when invoked with a function, offering a more convenient syntax.

Comments

comments powered by Disqus

back to Overview

Functions