how to get domcontentloaded via javascript code example Example: dom ready js document.addEventListener("DOMContentLoaded", function() { // code });