The comments from this question got me thinking about something. When exactly does the $(document).ready() function fire? The obvious answer would be \"when the
$(document).ready()
According to the jQuery site, $( document ).ready() will only run once the page Document Object Model (DOM) is ready for JavaScript code to execute.
$( document ).ready()
Reference: http://learn.jquery.com/using-jquery-core/document-ready/