Hi, i've created a script that works with the Dom so it has to wait until the Dom is ready before execute every operation. I want that this script can be included in two ways:
- In the head tag so that it is loaded before the Dom is ready. I've used
document.addEventListener("DOMContentLoaded",function(){...},false)
for this and it works well - Loaded dinamically when the Dom is already loaded. In this case the script doesn't work because for some reasons if the Dom is already loaded the DOMContentLoaded event isn't fired
So i want to know, is there a way to check if the Dom is already loaded so that the script can execute the code without using the DOMContentLoaded event?
PS: this must be an external script so i have no control on the page where it will be included