dom ready js
snippet in javascript

dom ready js

user7244

document.addEventListener("DOMContentLoaded", function() {
  // code
});

document ready javascript

user4642

$(document).ready(function(){
  $("button").click(function(){
    $("p").slideToggle();
  });
});

js ready

user8591

// without jQuery (doesn't work in older IEs)
document.addEventListener('DOMContentLoaded', function(){ 
    // your code goes here
}, false);