How to check if DOM is ready without a framework?

前端 未结 6 1262
有刺的猬
有刺的猬 2020-11-27 12:39

The question is so like a zillion others here and on the web - How to check if DOM has loaded in Javascript? But here\'s the catch:

  • Without using a framework l
6条回答
  •  天涯浪人
    2020-11-27 13:14

    Here is one way by running script at the bottom of the page. In addition by using the window.onload you can wait for all images/scripts to be loaded. Or you could simply place code at the bottom not waiting for images to be loaded.

    
    
    
    
    
    
    
    

    Edited: for Vilx's Comment

    Many onload bindings here is an example http://jsfiddle.net/uTF2N/3/

提交回复
热议问题