document.onreadystatechange

  • Revision slug: DOM/document.onreadystatechange
  • Revision title: document.onreadystatechange
  • Revision id: 94347
  • Created:
  • Creator: Crash
  • Is current revision? No
  • Comment changed link to the multi-page version of the spec; 7 words added, 1 words removed

Revision Content

{{ DomRef() }}

{{ gecko_minversion_header("2") }}

readystatechange

is fired when

document.readyState

is changed.

Syntax

document.onreadystatechange = funcRef;

funcRef is a function reference, called when the event is fired.

Example

// alternative to DOMContentLoaded
document.onreadystatechange = function () {
    if (document.readyState == "complete") {
        initApplication();
    }
}

See Also

Specification

Revision Source

<p>{{ DomRef() }}</p>
<p>{{ gecko_minversion_header("2") }}</p>
<p><strong>readystatechange</strong></p>
<p>is fired when</p>
<p><code>document.readyState</code></p>
<p>is changed.</p>
<h3 class="editable"><span>Syntax </span></h3>
<pre class="eval"><em>document.onreadystatechange = funcRef;</em>
</pre>
<p><em>funcRef</em> is a function reference, called when the event is fired.</p>
<h3 class="editable"><span>Example</span></h3>
<pre>// alternative to DOMContentLoaded
document.onreadystatechange = function () {
    if (document.readyState == "complete") {
        initApplication();
    }
}
</pre>
<h3 class="editable">See Also</h3>
<ul> <li><a class="internal" href="/en/DOM/document.readyState" title="en/DOM/document.readyState">document.readyState</a></li> <li><a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=347174" title="https://bugzilla.mozilla.org/show_bug.cgi?id=347174">Bug 347174</a> - Implement document.readystate == "complete"</li>
</ul>
<h3 class="editable"><span>Specification </span></h3>
<ul> <li><a class="external" href="http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#current-document-readiness" title="http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#current-document-readiness">http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#current-document-readiness</a></li>
</ul>
Revert to this revision