As title says, I am not sure about $(function () {})
Test:
$(function () {console.log("one")});
And at the bottom of body:
console.log("two");
the console prints two , one
Does it mean $(function () {})
is the same as $(document).ready(function(){});
?
Yes, just
$(function(){ })
is short-hand.See the
jQuery(callback)
overload documentation.