You might not want to wait for dom-ready to do your initialization.

Elements on the page may be active before dom-ready. I have run into
this problem with large pages and possibly pages with external scripts
included at the bottom (tracking scripts). The browser will display
what it can of the DOM as soon as it can, but dom-ready will not have
fired. This leaves elements visible to the user that they can interact
with without the event handlers attached.

I would recomend initializing your array as soon as it loads, and then
use jQuery.live() to attach event handlers.

On Sep 29, 8:44 am, Brams <ibrahim.ba...@gmail.com> wrote:
> Ok, so it seems i should be heading towards the namespace direction.
>
> Due to the structure that I'm using, i have to initialize this array right
> from the start (i.e in document.ready)...and after that i need to access it
> upon a button click or some change event on some element...is it correct to
> say that the code below is now valid for my case:
>
> var MYAPP = MYAPP || {}
>
> MYAPP.myArray = //my array
>
> THen every time i need that array i would simply:
> MYAPP.myarray
>
> is that correct?

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/jsmentors@jsmentors.com/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/jsmentors@googlegroups.com/

To unsubscribe from this group, send email to
jsmentors+unsubscr...@googlegroups.com

Reply via email to