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() { ... }; 3) Bind your functions as event handlers on the "body" object (or whatever) $('body').bind('Action1', function() { ... }); .... <body> <div> <!-- whatever --> <script> $('body').trigger('Action1'); </script> On Mon, Sep 21, 2009 at 7:03 PM, MorningZ <morni...@gmail.com> wrote: > > Do you have like this: > > External js file "code.js": > > $(document).ready(function() { > function Action1() { > // do stuff > } > }); > > > Html file "index.htm": > > <html> > <head> > <script type="text/javascript" src="code.js"></script> > </head> > <body> > ... some html here ... > <script>Action1()</script> > ... some html here ... > </body> > </html> > > if so, then "Action1" isn't defined yet (and it won't be until *all* > the HTML is spit out to the browser) and not available to use..... > > see this quick example: > > http://jsbin.com/edovi/edit > > the alert of "Run Action1" happens *before* the document is ready, and > as a result, the event getting wired up > > > On Sep 21, 7:11 pm, Matthew <matthewbchamb...@gmail.com> wrote: >> Hi all >> >> I've got a js file where all the functions are wrapped inside $ >> (document).ready(). I want to call one of the function from within the >> HTML but it says that the function "is not defined". Any ideas? >> >> Cheers >> Matthew -- Turtle, turtle, on the ground, Pink and shiny, turn around.