Hey, thanks a lot for the replies guys. Eric, I tried what you suggested, but I was getting javascript syntax errors reported.
So, rather than: $(function(){ $.displayMessage(){ alert('hello world') } // throws js syntax errors }); $(function(){ $.displayMessage(); }); I had to do: $(function(){ $.displayMessage = function(){ alert('testing') }; // works fine }); $(function(){ $.displayMessage(); }); I really appreciate you pointing me in the right direction on that. With that said, I'm guessing you can't "directly" declare a function in the jQuery namespace like I tried to do in the first example, and instead you have to assign a function to a variable handle in the jQuery namespace instead, as in the second example? Waseem, as far as the suggestion on writing my own plugin, I was considering that approach as well, and I may end up going that route. The funny thing is, the actual method I'm trying to call is already a call off a plugin, so essentially I would be writing a plugin to reference another plugin. Do any gotchas come to mind doing things that way, or would that be considered a fairly common practice? Thanks again for your thoughts, Brian Thanks a lot! Brian On May 29, 3:54 pm, waseem sabjee <waseemsab...@gmail.com> wrote: > 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