Answers for "waiting until the document is ready javascript"

8

javascript wait for document load

document.addEventListener("DOMContentLoaded", function(event) { 
  //do work
});
Posted by: Guest on May-19-2020
0

check if the document is ready js

let stateCheck = setInterval(() => {
  if (document.readyState === 'complete') {
    clearInterval(stateCheck);
    // document ready
  }
}, 100);
Posted by: Guest on August-19-2021

Code answers related to "waiting until the document is ready javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language