Does this code need to be in a document.ready?

前端 未结 7 2072
清酒与你
清酒与你 2020-12-28 13:09

The document.ready is used to execute code after the DOM is fully loaded. This can be used to attach event handlers to elements on the page e.g



        
相关标签:
7条回答
  • 2020-12-28 14:06

    The only drawback of not binding an event to the document in a document.ready block would be that it will be possible to fire the event before all the page content has been loaded, which may not be what you want.

    0 讨论(0)
提交回复
热议问题