You should be fine defining your functions outside of document.ready.
If your really want, you could do something like:

var myFunction;
$(document).ready(function() {
  myFunction = function(param1, param2) {
  };
  ...
});

Or:

$(document).ready(function() {
  window.myFunction = function(...) {
  };
  ...
});

Either of those would make the function available outside of $document.ready.

--Erik


On 8/28/07, DaveG <[EMAIL PROTECTED]> wrote:
>
>  > Why would you want to delay the definition of a function?
> I'm not really sure we need to, but it's basically some pre-existing
> code. One of those rush things where we had a problem with the DOM not
> being ready, and ended up blitzing all inline javascript with onready calls.
>
>
>
> Erik Beeson wrote:
> > Why would you want to delay the definition of a function?
> >
> > --Erik
> >
> >
> > On 8/28/07, DaveG <[EMAIL PROTECTED]> wrote:
> >> If I use the jQuery document.ready shortcut to delay the definition of a
> >> javascript function test(), what is the correct way to reference test()?
> >>
> >> This does not work:
> >>     jQuery ( function() { function test() {alert('here')} } );
> >>     test;  // assume that test is defined at this point...
> >>
> >> I thought it might be something like this, but no joy there either:
> >>     localJQ = jQuery ( function() { function test() {alert('here')} } );
> >>     localJQ.test;
> >>
> >>
> >>   ~ ~ Dave
> >>
> >
>

Reply via email to