How can I implement my own $(document).ready functionality without using jQuery?

Technology CommunityCategory: jQueryHow can I implement my own $(document).ready functionality without using jQuery?
VietMX Staff asked 3 years ago

There is a standards based replacement, DOMContentLoaded that is supported by over 98% of browsers, though not IE8:

document.addEventListener("DOMContentLoaded", function(event) { 
  //do work
});