Hi,
I am doing what you suggest:
I have my code like this, but I get "$ is undefined"

<head>
        <title>Test</title>
        <script type="text/javascript" src="js/jquery.js"></script>
        <script type="text/javascript" src="js/nav.js" ></script>
</head>


It seems jquery.js isn't loaded before nav.js, but this is declared in
the head section, so I am puzzled why this is happening.



On Nov 26, 11:39 am, tlphipps <[EMAIL PROTECTED]> wrote:
> You need to make sure that jquery.js is included BEFORE your
> external .js file that attempts to use jquery code.
>
> On Nov 26, 7:55 am, Stephen <[EMAIL PROTECTED]> wrote:
>
> > Hi,
> > I'm using Firefox 2.0.0.9.  IE 6 exhibits the same problem also.  I'm
> > totally stumped.
>
> > --Stephen
>
> > On Nov 26, 5:08 am, Polskaya <[EMAIL PROTECTED]> wrote:
>
> > > I don't know why you have this error. This works fine for me:
>
> > > In the header of my index-page:
> > > <script type="text/javascript" src="jscript.js"></script>
>
> > > in the jscript.js:
>
> > > $(document).ready(function(){
> > > //--jquery code goes here
>
> > > });
>
> > > On Nov 26, 5:22 am, Stephen <[EMAIL PROTECTED]> wrote:
>
> > > > Hi,
> > > > I have read a few tutorial docs, and they all state that $
> > > > (document).ready()  be placed in a <script> tag on the current
> > > > document, like so:
>
> > > > <head>
> > > >         <title>Test</title>
> > > >         <script type="text/javascript" src="js/jquery.js"></script>
> > > >         <script type="text/javascript">
> > > >                $(document).ready(function() {
> > > >                     // Add some code here
> > > >                } );
> > > >         </script>
> > > > </head>
>
> > > > When I try to move $(document).ready() to nav.js, I keep getting a
> > > > browser error message that says "$ is not defined."
>
> > > > <head>
> > > >         <title>Test</title>
> > > >         <script type="text/javascript" src="js/jquery.js"></script>
> > > >         <script type="text/javascript" src="js/nav.js" ></script>
> > > > </head>
>
> > > > Is there a way to load up the ready() function in a separate file?  I
> > > > am using Jquery 1.2.1.
>
> > > > Thanks,
> > > > Stephen

Reply via email to