js function for ready document code example
Example 1: document ready javascript
$(document).ready(function(){
$("button").click(function(){
$("p").slideToggle();
});
});
Example 2: js ready
// without jQuery (doesn't work in older IEs)
document.addEventListener('DOMContentLoaded', function(){
// your code goes here
}, false);