How to run a code load and DOMContentLoaded fails

Question: How to run a code load and DOMContentLoaded fails

Answer:

var t = setInterval(removeDiv, 1000);

    function removeDiv(){
        let imgEl = document.querySelectorAll("[src='my-image.png']");
        console.log('imgEl: ', imgEl);
        if(imgEl.length > 0 ){
            clearInterval(t);
        }
    }
Scroll to Top