[jQuery] Re: Accessing functions inside $(document).ready()

2009-09-23 Thread James
> I'm not to sure why the developer > wrapped it all in the ready() function but I'll have to painfully pull > it apart now... nothing's ever easy is it :) Maybe they wanted to try not to pollute the global namespace? Were there a lot of functions defined? I guess if that was the idea and you wan

[jQuery] Re: Accessing functions inside $(document).ready()

2009-09-23 Thread Trazek
Hello all. I ran into a similar problem just today and decided to share my solution. Similar to Mike's 3rd suggestion: "3) Bind your functions as event handlers to the 'body' object (or whatever)" I decided to assign the function references I wanted to call outside the ready function to

[jQuery] Re: Accessing functions inside $(document).ready()

2009-09-21 Thread Matthew
Ok thanks MorningZ. I've taken a different approach. I'm just binding the onClick logic to the button within the .ready() block. Thanks again for all the help! Cheers Matthew On Sep 22, 10:39 am, MorningZ wrote: > Mike's suggestion indeed is the rest of it...  i was just trying to > get you pa

[jQuery] Re: Accessing functions inside $(document).ready()

2009-09-21 Thread MorningZ
Mike's suggestion indeed is the rest of it... i was just trying to get you past the fact that until $(document).ready fires, you can't do anything with code inside there yet On Sep 21, 8:28 pm, Matthew wrote: > @MonringZ: I just tried the brilliant testing website! I just wanted > to double che

[jQuery] Re: Accessing functions inside $(document).ready()

2009-09-21 Thread Matthew
@MonringZ: I just tried the brilliant testing website! I just wanted to double check; so because Action1() is wrapped inside the ready() function it esentially is processed as the page loads and then basically disappears/become unavailable. I took your example further and added a button with an on

[jQuery] Re: Accessing functions inside $(document).ready()

2009-09-21 Thread Matthew
Hi guys Thanks for the great feedback. MorningZ was right on the money with my scenario. I'm incorporating a js file of a photo gallery which was built by some else and all the code is wrapped in the $(document).ready () function. So it looks like you all seem to agree that all the methods insid

[jQuery] Re: Accessing functions inside $(document).ready()

2009-09-21 Thread Lord Gustavo Miguel Angel
hi! please write here you code. Thanks. -- From: "Matthew" Sent: Monday, September 21, 2009 8:11 PM To: "jQuery (English)" Subject: [jQuery] Accessing functions inside $(document).ready() Hi all I've got a js file where all the functions are

[jQuery] Re: Accessing functions inside $(document).ready()

2009-09-21 Thread Mike McNally
Well "Action1" is a local function to that jQuery "ready" function, so it's *never* going to be available as a global function. A couple of options: 1) Turn your wannabe-global functions into jQuery plugins 2) Explicitly add your functions to the window object window['Action1'] = function

[jQuery] Re: Accessing functions inside $(document).ready()

2009-09-21 Thread MorningZ
Do you have like this: External js file "code.js": $(document).ready(function() { function Action1() { // do stuff } }); Html file "index.htm": ... some html here ... Action1() ... some html here ... if so, then

[jQuery] Re: Accessing functions inside $(document).ready()

2009-09-21 Thread Jeffrey Kretz
It isn't necessary to define the functions inside the document.ready. Just code which is being executed. Example: function Do_Something() { /// } function Do_Something_Else() { /// } $(document).ready(function(){ Do_Something(); }); JK -Original Message- From: jquery-en@go