The jQuery isReady property was designed to do exactly what you're
trying to accomplish. If you call:

$(function(){}); before the DOMReady, it will trigger the function
once it occurs. If you call it after the DOMReady, it will trigger
immediately. The isReady property exists so, when it's false, it binds
events, and when its true, it just triggers them.

On Apr 16, 7:41 am, blasto333 <m...@chrismuench.com> wrote:
> JQuery.isReady is NOT documented, but I have a valid use case for it
> and was wondering if there is a documented way of doing the same
> thing.
>
> I have a case where some code could be loaded as the page loads, but I
> don't have a particular function to fire until the document isReady.
>
> The same code could also be loaded in a context after the page loads
> (Injected into the dom)
>
> if (JQuery.isReady)
> {
>     //Call function explicitly}
>
> else
> {
>  //Call function on document.ready()
>
> }

Reply via email to