Get innerHTML after the page loads completely
<p>I'm attempting a make random quote machine with a tweet button to tweet the quote.
The random quote is coming up just fine. 
The code..</p>

<pre><code>var forismaticAPI = 'http://api.forismatic.com/api/1.0/?method=getQuote&amp;format=jsonp&amp;lang=en&amp;jsonp=?';
$(document).ready(function() {
    var template = function(data) {
        $('#quotearea').empty();
        $('#quotearea').append('&lt;blockquote id="quote"&gt;' + data.quoteText + '&lt;/blockquote&gt;' + '&lt;p id="author"&gt; —  ' + data.quoteAuthor + '&lt;/p&gt;');
        $('#quotearea').show();
    };

    var dataAppend = function() {
        $.getJSON(forismaticAPI, template);
    };
}
</code></pre>

<p>My next task is to get the quote content to be tweeted. So once the window loads completely i want to get the innerHTML of <code>#quote</code> which contains the quote. So i write a window.onload function like this..</p>

<pre><code>window.onload = function(){
    var quote = document.getElementById('quote');
    console.log(quote.innerHTML);

}
</code></pre>

<p>But I'm getting an error <code>Uncaught TypeError: Cannot read property 'innerHTML' of null(…)</code>.. Since there is small delay in loading the quote, the window load function returns a null. How to get the innerHTML of a div only when the content is loaded and ready?</p>