jQuery

$(document).ready(function(){...}) vs $(function() {...}) -- What's the diff?

I’ve been exposed to the “new” way of doing the common jquery statement:

//we all have done or do this:
$(document).ready(function {…} );

//the “new” way
$(function(){…});

So what’s the difference!?

After a little research, this is what I’ve found:

Essentially there is no difference between the two statement. The latter is just a shortcut for the first. To me, the first is a little more intuitive. When passing an anonymous function to jQuery, it will wait for the document to be ready anyway. So, both statements are

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer