Four variations of jQuery ready() — what's the difference?

后端 未结 4 570
鱼传尺愫
鱼传尺愫 2020-12-09 12:41

I\'ve seen four different ways to tell jQuery to execute a function when the document is ready. Are these all equivalent?

$(document).ready(function () {
           


        
4条回答
  •  一个人的身影
    2020-12-09 13:15

    Here's another one - starts like this...

    (function (jQuery) {
    

    then to finish...

    })(jQuery);
    

    An example is here: http://jsfiddle.net/C2qZw/23/

提交回复
热议问题