The easiest way would be to develop your own jquery plugins as plugins are able to reference each other even in different files.
like i have a plugin that allows me to slide left and right. then i have a plugin to expand and contract. i can call either one in either plugin file. On Fri, May 29, 2009 at 8:07 PM, Eric Garside <gars...@gmail.com> wrote: > > It's a simple scoping problem. Anything you create inside an anonymous > function will be accessible only within the function. If you need > something to be accessible between the anon. functions, simply move it > into a higher scope, like the global namespace (eh, not idea) or the > jQuery namespace (better idea). > > $(function(){ > $.displayMessage(){ alert('hello world') } > }); > > $(function(){ > $.displayMessage(); > }); > > On May 29, 12:18 pm, Brian FitzGerald <fitzgeraldme...@gmail.com> > wrote: > > I know that you can have more than on document ready event without > > difficulty. i.e. > > > > $(function(){ > > // document ready 1 > > > > }); > > > > $(function(){ > > // document ready 2 > > > > }); > > > > The question I have is, is there any way for them to call functions > > from one to the other? The following does not work: > > > > $(function(){ > > function displayMessage(){ alert('hello world'); }; > > > > }); > > > > $(function(){ > > displayMessage(); > > > > }); > > > > This invokes a js error complaining that displayMessage() is not > > defined. > > > > Thanks in advance for any thoughts, > > Brian >