jquery - How to detect if DOM has finished build? - Stack Overflow

What jQueryJavaScript mand can I use to detect whether the DOM (driven by a custom function) has been

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
Add a ment  | 

2 Answers 2

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 () { })

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745643318a4637822.html

相关推荐

  • jquery - How to detect if DOM has finished build? - Stack Overflow

    What jQueryJavaScript mand can I use to detect whether the DOM (driven by a custom function) has been

    3小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信