jquery function wrap vs dom ready [duplicate]
题
Possible Duplicate:
What is the difference between these jQuery ready functions?
$(function(){
// ... do stuff
});
VS
$(document).ready(function() {
// ... do stuff
});
I saw the first one in some old code and I assume the two are similar? Is there a benefit to one over the other?
解决方案
According to the jQuery Documentation those are equivalent
其他提示
they are the same exact thing. i started using the 1st method now as it's more shorthand
They are the same, except the first version is just shorthand.
不隶属于 StackOverflow