The ready
event occurs after the HTML document has been loaded, while the onload
event occurs later, when all content (eg images) also has been loaded.(ready
事件在HTML文档已加载之后发生,而onload
事件在稍后又加载了所有内容(例如图像)时发生。)
The onload
event is a standard event in the DOM, while the ready
event is specific to jQuery.(onload
事件是DOM中的标准事件,而ready
事件特定于jQuery。) The purpose of the ready
event is that it should occur as early as possible after the document has loaded, so that code that adds functionality to the elements in the page doesn't have to wait for all content to load.(ready
事件的目的是,它应该在文档加载后尽早发生,从而使向页面中的元素添加功能的代码不必等待所有内容加载。) 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…