[jQuery] Re: $(document).ready() vs $(function () {});

2008-10-21 Thread Karl Swedberg

Hi Shawn,

They're functionally equivalent. The only difference is that $ 
(function() {}); is shorter and $(document).ready(function() {}); is,  
at least to me, more intuitive.


--Karl


Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Oct 21, 2008, at 12:56 AM, Shawn wrote:



I am seeing more and more references to using the $(function() {});  
format for

the ready method.  Is there a compelling reason for this?  Or will
$(document).ready() perform as well?

Or perhaps I'm mis-understanding what the newer format is being used  
for?


Thanks for any tips.

Shawn




[jQuery] Re: $(document).ready() vs $(function () {});

2008-10-21 Thread 汪杰
you are also using $.fn.ready(function(){

});
this is the most direct way to use it


[jQuery] Re: $(document).ready() vs $(function () {});

2008-10-20 Thread Isaak Malik
Both are exactly the same, the first one is just a shorter way to write and
one step further in fast development with jQuery

On Tue, Oct 21, 2008 at 6:56 AM, Shawn <[EMAIL PROTECTED]> wrote:

>
> I am seeing more and more references to using the $(function() {}); format
> for
> the ready method.  Is there a compelling reason for this?  Or will
> $(document).ready() perform as well?
>
> Or perhaps I'm mis-understanding what the newer format is being used for?
>
> Thanks for any tips.
>
> Shawn
>



-- 
Isaak Malik
Web Developer