开发者

How should I combine $(document).ready statements?

Is it appropriate to combine all functions that wouldn't conflict into one

$(document).ready(function) {
});

or

$(function() {
});

call to sa开发者_如何学编程ve a couple lines?


To jQuery, it makes no difference whether to use one big .ready() handler, or call it several times. Internally, they all got merged together anyway or will get fired instantly when the DOM is ready already.

In my opinion, it's not a good practice to have more than one .ready() handler. Its like asking for confusion.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜