Animations

API

Arrays

Async

Basics

Challenges

Classes

Console

Dates

Debugging

DOM Elements

DOM Methods

DOM Navigation

DOM Properties

Event Listeners

Flow Control

Forms

Functions

Global Functions

JSON

Keywords

Libraries (3rd party)

Math

Modules

Objects

Snippets

String

Types

Widgets

Window Object

JavaScript - Document Ready

There is no document.ready out of the box method from javascript like jQuery offers. You can however, use one of the three techniques below:


// Option 1
<body>
    ...content...
    <script>
      ...my stuff...
    </script>
</body>

// Option 2
// onreadystatechange
document.onreadystatechange = function ()
{
    if (document.readyState == "complete")
{
        // document is ready. Do your stuff here
    }
}

// Option 3
// DOMContentLoaded
document.addEventListener('DOMContentLoaded', function()
{
    // document is ready. Do your stuff here
})

 

http://www.w3schools.com/js/js_htmldom_document.asp