What is the DOM ready event?

前端 未结 5 1535
攒了一身酷
攒了一身酷 2020-12-01 09:29

I need to fire a script as soon as the page content (the whole HTML element) has been received, but it doesn\'t have to be rendered yet.

I assume that just having a

5条回答
  •  时光取名叫无心
    2020-12-01 10:16

    DOM ready means that all the HTML has been received and parsed by the browser into the DOM tree which can now be manipulated.

    It occurs before the page has been fully rendered (as external resources may have not yet fully downloaded - including images, CSS, JavaScript and any other linked resources).

    The actual event is called DOMContentLoaded.

提交回复
热议问题