tags:

views:

57

answers:

3

Is

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

the same as

$(function(){});

?

I believe it is, actually I'm 99% sure it is but wanted a 'second' opinion

+1  A: 

Indeed it is. Personal preference.

thenduks
+1  A: 
jessegavin
+2  A: 

Yes

"the document-ready idiom is so common, in fact that there's a shortcut version of it... The expanded version $(document).ready is arguably a better example of self-documenting code; it's much easier to see at a glance exactly what's going on - especially if it's buried in a page of another developers JavaScript!" - Borrowed from - jQuery Novice to Ninja

chainwork