When exactly the $(document).ready callback is executed?

后端 未结 6 1138
别那么骄傲
别那么骄傲 2021-01-30 19:57

Suppose that we attach a .click() handler to an anchor () tag in the $(document).ready callback. This handler will cancel the default action (following the

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-30 20:24

    In YUI, there are the methods onContentReady() and onAvailable(). unfortunately there is no equivalent to that in jQuery. However there is a plugin that was inspired by them:

    http://www.thunderguy.com/semicolon/2007/08/14/elementready-jquery-plugin/

    This should allow you to bind the events to the anchor before the DOM is fully loaded.

提交回复
热议问题