document.onreadystatechange

  • Revision slug: DOM/document.onreadystatechange
  • Revision title: document.onreadystatechange
  • Revision id: 94341
  • Created:
  • Creator: Crash
  • Is current revision? No
  • Comment no wording changes

Revision Content

{{ gecko_minversion_header("1.9.2") }}

readystatechange is fired when document.readyState is changed

Syntax

document.onreadystatechange = funcRef;

funcRef is a function reference

Example

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

See Also

Specification

Revision Source

<p>{{ gecko_minversion_header("1.9.2") }}</p>
<p><strong>readystatechange</strong> is fired when document.readyState 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</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/#current-document-readiness" title="http://www.whatwg.org/specs/web-apps/current-work/#current-document-readiness">http://www.whatwg.org/specs/web-apps/current-work/#current-document-readiness</a></li>
</ul>
Revert to this revision