1var checkExist = setInterval(function() {
2 if ($('#the-canvas').length) {
3 console.log("Exists!");
4 clearInterval(checkExist);
5 }
6}, 100); // check every 100ms
7
1document.addEventListener("DOMContentLoaded", function(event) {
2 //do work
3});
1loading = setInterval(function () {
2 if (document.getElementById("myElement")) {
3 // Element Has Loaded, Put your code here!
4 clearInterval(loading);
5 }
6}, 100); // Checks every 100ms(0.1s)
1document.addEventListener('DOMContentLoaded', (event) => {
2 //the event occurred
3})
4
1var checkExist = setInterval(function() {
2 if ($('#my-element').length) {
3 console.log("Exists!");
4 clearInterval(checkExist);
5 }
6}, 100); // check every 100ms
7