how to use ready event code example
Example 1: javascript wait for document load
document.addEventListener("DOMContentLoaded", function(event) {
//do work
});
Example 2: document ready javascript
$(document).ready(function(){
$("button").click(function(){
$("p").slideToggle();
});
});