Firefox DOMContentLoaded event problem

Posted by mck89 on Stack Overflow See other posts from Stack Overflow or by mck89
Published on 2010-03-23T14:42:53Z Indexed on 2010/03/23 15:03 UTC
Read the original article Hit count: 304

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about dom