admin管理员组文章数量:1435764
What jQuery/JavaScript mand can I use to detect whether the DOM (driven by a custom function) has been built before populating the fields inside it? Currently the latter fails unless I put in an alert box in between the 2 actions.
What jQuery/JavaScript mand can I use to detect whether the DOM (driven by a custom function) has been built before populating the fields inside it? Currently the latter fails unless I put in an alert box in between the 2 actions.
Share Improve this question asked May 19, 2011 at 1:04 ErnestErnest 8244 gold badges12 silver badges25 bronze badges 1- http://www.whatwg/specs/web-apps/current-work/multipage/dom.html#current-document-readiness – RobG Commented May 19, 2011 at 2:26
2 Answers
Reset to default 6$(function() { })
will tell you when the DOM is ready to be accessed.
If your custom function is adding things to the DOM, the best way would be to build something into it that notifies some code when it is done.
You can look at document.readyState
. If the page is ready it should be "plete"
.
You can also use document.addEventListener('DOMContentLoaded', function () { })
本文标签: jqueryHow to detect if DOM has finished buildStack Overflow
版权声明:本文标题:jquery - How to detect if DOM has finished build? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745643318a2667987.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论