Thanks that was a very helpful answer.

Adrian Sweeney
Web Developer
Mills & Reeve
Tel: +44(0)121 456 8236
mailto:[EMAIL PROTECTED]
http://www.mills-reeve.com


-----Original Message-----
From: Klaus Hartl [mailto:[EMAIL PROTECTED] 
Sent: 31 October 2006 09:58
To: jQuery Discussion.
Subject: Re: [jQuery] $(document).ready question


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
[email protected]
http://jquery.com/discuss/


<b>Birmingham Law Society 'Law Firm of the Year' 2006</b>
____________________________________________________________________

<b>Mills & Reeve - one of The Sunday Times 100 Best Companies To Work For in 
2004, 2005 and 2006</b>

This email is confidential and may be privileged.  If you are not the intended 
recipient please accept our apologies; please do not disclose, copy, or 
distribute information in this email nor take any action in reliance on its 
contents: to do so is strictly prohibited and may be unlawful. Please inform us 
that this message has gone astray before deleting it. Thank you for your 
co-operation.

Mills & Reeve Solicitors, offices at:

Birmingham: 78-84 Colmore Row, Birmingham, B3 2AB.
Cambridge:  Francis House, 112 Hills Road, Cambridge CB2 1PH. 
Norwich: 1 St James Court, Whitefriars, Norwich NR3 1RU.
London:  Fountain House, 130 Fenchurch Street, London, EC3M 5DJ.

Mills & Reeve is regulated by the Law Society.

A list of Partners may be inspected at any of the above addresses.

Visit our web site at: http://www.mills-reeve.com

This message has been checked for viruses by the Mills & Reeve screening system.

Service cannot be effected on us by e mail.



_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to