Adrian Sweeney schrieb:
> Question:  why would you want to have multiple $(document).ready statements
> 
> Why not just the following
> $(document).ready(function(){
>       //do this
>       initialise functionality 
> 
>       // then this
>       DrawScreen functionality 
> 
>       // then this
>       AddMouseEvents  functionality 
> 
>       // then this
>       return false;
> });

Adrian,

because if you have modular scripts that can be plugged in on its own, 
you maybe don't want to edit an initialize function somewhere to make it 
work instead of just simply adding the script include to the head and 
you are ready. It could also be the case that your initialize function 
is suitable for one page but not for another one.

I sometimes think the putting-everything-into-one-initialize-function 
approach is a relict of the times we all did:

<body onload="init();">

But of course thats only my opinion and which way to go is more or less 
a matter of taste. Both approaches have their pros and cons.


-- Klaus


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to