> >>> This does not work: > >>> jQuery ( function() { function test() {alert('here')} } ); > >>> test; // assume that test is defined at this point...
> > That's what didn't make sense. You want to define test later, but > > reference it now? No, you can't do that. > Well the sample is simplified, hence the code-comment. What > actually happens is that test would be called based on a user > triggered event, in theory post-document ready. > > I currently have a function being defined within a document > ready block. > I'd like to be able to access that function outside of the > document ready block, within the 'normal' javascript scope. > For the sake of this case we can assume that we won't try to > use the function before the document is ready. Ah, now I'm following you! I'm slow today. This will work: var test; jQuery ( function() { test = function() {alert('here')} } ); // and sometime later in your code, after document.ready fires test(); // test is defined at this point... -Mike