ondocumentready function executes when code example Example: dom ready js document.addEventListener("DOMContentLoaded", function() { // code });