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.
精彩评论