Sign in


Registers a function to be executed once the page DOM has loaded.


neon.ready(function callback)


The function to execute once the page DOM has loaded.

Return value

This method has no return value. It was decided not to make this method chainable to prevent potential confusion, since the method accepts a function that is not executed immediately.


This method can be used to delay execution of some commands until after the page DOM has fully loaded.

If you have placed your script into a <script> element in the page, then at the time it executes the rest of the page will not yet have been loaded into the document. It would not therefore be possible to access elements contained in the page at the point below the <script> element.

This function can be used to allow execution of some commands to be delayed until after the rest of the elements in the page have become part of the document.

It is safe to call this method many times, each with different callback functions. Each callback will be executed in order once the page is ready. It is also safe to use this method if there is a chance the rest of the page has already loaded - the callback would then be executed immediately.

If the Neon core library itself was not included using a <script> element (for example, if it was loaded dynamically by another Javascript framework), this method is not likely to work properly. In those cases, you may want to see if your other Javascript framework has an equivalent method.