解决方法
从
here开始:
Under the hood: $(document).ready() As you would expect from John
Resig,jQuery’s method for determining when the DOM is ready uses an
assortment of optimizations. For example,if a browser supports the
DOMContentLoaded event (as many non-IE browsers do),then it will fire
on that event. However,IE can’t safely fire until the document’s
readyState reaches “complete”,which is typically later. If none of
those optimizations are available,window.onload will trigger the
event.
这些事件独立于HTML标记内的位置,因为即使在呈现< / body>时,其他事件仍在进行中.