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

Reply via email to