JavaScript Aguarde a carga do documento
document.addEventListener("DOMContentLoaded", function(event) {
//do work
});
Xenophobic Xenomorph
document.addEventListener("DOMContentLoaded", function(event) {
//do work
});
var checkExist = setInterval(function() {
if ($('#the-canvas').length) {
console.log("Exists!");
clearInterval(checkExist);
}
}, 100); // check every 100ms
document.addEventListener('DOMContentLoaded', (event) => {
//the event occurred
})
loading = setInterval(function () {
if (document.getElementById("myElement")) {
// Element Has Loaded, Put your code here!
clearInterval(loading);
}
}, 100); // Checks every 100ms(0.1s)
var checkExist = setInterval(function() {
if ($('#my-element').length) {
console.log("Exists!");
clearInterval(checkExist);
}
}, 100); // check every 100ms
var checkExist = setInterval(function() {
if ($('#the-canvas').length) {
console.log("Exists!");
clearInterval(checkExist);
}
}, 100); // check every 100ms