Re: [jQuery] Newbie question about document ready statement

2006-10-03 Thread David Duymelinck
[EMAIL PROTECTED] schreef:
>
> I personally use a modular approach, since different pages may utilize only a 
> portion of the available functions. My attitude is, why load what isn't used? 
> Of course, YMMV (your mileage may vary).
>   

The approach I take for loading functions is taking a page element id 
that is unique for the website and check if it's there with the size 
function

if($('#someid').size()  >= 1){
   //functions for that page
}

i don't know if it's the best way but it worked for me so far.

-- 
David Duymelinck

[EMAIL PROTECTED]


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


Re: [jQuery] Newbie question about document ready statement

2006-10-03 Thread kscholl . jq
Paul,

Either is fine; JQuery will happily execute one or more ready statements. If 
you have multiples, they will be executed in the order in which they are 
encountered in the code.

I personally use a modular approach, since different pages may utilize only a 
portion of the available functions. My attitude is, why load what isn't used? 
Of course, YMMV (your mileage may vary).

Welcome to JQuery!

Kevin


 -- Original message --
From: "Caton, Paul" <[EMAIL PROTECTED]>
> Please forgive what might seem a stupidly basic question but I'm new to
> jQuery and the tutorials/API doc have not made the answer clear to me:
> 
> Should you use a separate 
> 
> $(document).ready(function(){
> // Your code here
>   });
> 
> for each function you write, or do you just have one wrapping "ready
> statement" and put all your functions inside it?
> 
> Thanks,
> 
> Paul Caton.
> 
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/



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


Re: [jQuery] Newbie question about document ready statement

2006-10-03 Thread David Duymelinck
You can put all your functions inside one  $(document).ready( ); , or 
use the shorthand $(function(){}); , but then you have to be aware that 
ajax generated html will not fire because the page hasn't reloaded.
For ajax generated code you best put your functions outside the 
$(document).ready( ); and call then inside.


Caton, Paul schreef:
> Please forgive what might seem a stupidly basic question but I'm new to
> jQuery and the tutorials/API doc have not made the answer clear to me:
>
> Should you use a separate 
>
> $(document).ready(function(){
> // Your code here
>   });
>
> for each function you write, or do you just have one wrapping "ready
> statement" and put all your functions inside it?
>
> Thanks,
>
> Paul Caton.
>
> ___
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
>
>
>   


-- 
David Duymelinck

[EMAIL PROTECTED]


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


[jQuery] Newbie question about document ready statement

2006-10-03 Thread Caton, Paul
Please forgive what might seem a stupidly basic question but I'm new to
jQuery and the tutorials/API doc have not made the answer clear to me:

Should you use a separate 

$(document).ready(function(){
// Your code here
  });

for each function you write, or do you just have one wrapping "ready
statement" and put all your functions inside it?

Thanks,

Paul Caton.

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