Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

An AMD compatible module to detect when the DOM is ready. Based on jQuery's source code.

branch: master

README version correction

This is 1.4.0 version!
latest commit 790bf76d10
Túbal Martín authored October 03, 2013
Octocat-spinner-32 tests version 1.3.1 final! October 03, 2013
Octocat-spinner-32 README.md README version correction October 03, 2013
Octocat-spinner-32 ondomready.js version 1.3.1 final! October 03, 2013
Octocat-spinner-32 ondomready.min.js version 1.3.1 final! October 03, 2013
README.md

onDomReady

A function that allows you to safely initialize your code when the DOM is ready.

  • Bullet proof: Based on jQuery's ready() method (same behavior & reliability).
  • Easy to maintain: Since onDomReady is based on jQuery's implementation, whenever the jQuery team improves it onDomReady will be updated.
  • Browser support: IE6+
  • AMD compatible (anonymous module = more portable),
  • MIT license.

How to use:

// Functions passed to onDomReady will be executed as soon as the DOM is ready.

// Execute this function ASAP
onDomReady( function() {
    // Your code
} );

// Define a callback
var init = function() {
    // Your code
};

// Execute the init function ASAP
onDomReady( init );

// Get the version of onDomReady (string)
var version = onDomReady.version; // "1.4.0"

// Check at anytime whether DOM is ready
onDomReady.isReady(); // returns true or false (version 1.4.0+)

Changelog

3 Oct 2013
Version 1.4.0: based on jQuery 1.10.x but keeping support for IE6+

13 Jun 2013
Version 1.3: based on jQuery 1.10.x but keeping support for IE6+

18 Sep 2012
Version 1.2: based on jQuery 1.8.1

11 Aug 2012
Version 1.1: based on jQuery 1.8.0

8 Apr 2012
Version 1.0: based on jQuery 1.7.2

Something went wrong with that request. Please try again.