Is it really necessary to wait for DOM ready to manipulate the DOM?

前端 未结 4 774
北海茫月
北海茫月 2020-12-11 08:03

Is it really necessary to wait for the \"ready\" (or \"window.onload\") events if your code only manipulates DOM elements that have already been parsed entirely?

The

4条回答
  •  长情又很酷
    2020-12-11 08:37

    Yes, it's safe if you js code is after dom but usually it's not relly good idea to mix html and js.

提交回复
热议问题