[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

Error can't find variable: $

Bint

1/8/2015 7:17:00 PM

I tried to add a date formatting script to my html file, and I started
getting this error -- it doesn't happen every time, though. I was already
including jQuery in my <head>. I put the new script include at the bottom
of the <body>, but it still gives me the error. Anyone know what I can do
to fix it?

I haven't gotten this error when using jQuery on my own -- just once I tried
to include this date formatter..

Thanks

17 Answers

Thomas 'PointedEars' Lahn

1/8/2015 9:27:00 PM

0

Bint wrote:

> I tried to add a date formatting script to my html file, and I started
> getting this error -- it doesn't happen every time, though. I was already
> including jQuery in my <head>. I put the new script include at the bottom
> of the <body>, but it still gives me the error. Anyone know what I can do
> to fix it?
>
> I haven't gotten this error when using jQuery on my own -- just once I
> tried to include this date formatter..

--
PointedEars
FAQ: <http://PointedEars.... | SVN: <http://PointedEars.de...
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-...
Please do not cc me. / Bitte keine Kopien per E-Mail.

Denis McMahon

1/8/2015 10:01:00 PM

0

On Thu, 08 Jan 2015 13:17:12 -0600, Bint wrote:

> I tried to add a date formatting script to my html file, and I started
> getting this error -- it doesn't happen every time, though. I was
> already including jQuery in my <head>. I put the new script include at
> the bottom of the <body>, but it still gives me the error. Anyone know
> what I can do to fix it?
>
> I haven't gotten this error when using jQuery on my own -- just once I
> tried to include this date formatter..

It's a good job that we're all psychic and can feel our way across the
internet to your machine to read your code and see the error message
you're getting, because otherwise, inb the absence of you posting the
actual code and error messages, we wouldn't have a clue as to what the
problem is.

The problem at the moment is that you have no idea how to ask for coding
help:

1) Post the code that gives the error
2) If it gives an error message, post the error message message
3) If otherwise it's not doing what you want, tell us (a) what you want
it to do and (b) what it actually does.


--
Denis McMahon, denismfmcmahon@gmail.com

Bint

1/9/2015 2:09:00 AM

0


On 1/8/15, 4:00 PM, in article m8mum7$k6e$1@dont-email.me, "Denis McMahon"
<denismfmcmahon@gmail.com> wrote:

> On Thu, 08 Jan 2015 13:17:12 -0600, Bint wrote:
>
>> I tried to add a date formatting script to my html file, and I started
>> getting this error -- it doesn't happen every time, though. I was
>> already including jQuery in my <head>. I put the new script include at
>> the bottom of the <body>, but it still gives me the error. Anyone know
>> what I can do to fix it?
>>
>> I haven't gotten this error when using jQuery on my own -- just once I
>> tried to include this date formatter..
>
> It's a good job that we're all psychic and can feel our way across the
> internet to your machine to read your code and see the error message
> you're getting, because otherwise, inb the absence of you posting the
> actual code and error messages, we wouldn't have a clue as to what the
> problem is.
>
> The problem at the moment is that you have no idea how to ask for coding
> help:
>
> 1) Post the code that gives the error
> 2) If it gives an error message, post the error message message
> 3) If otherwise it's not doing what you want, tell us (a) what you want
> it to do and (b) what it actually does.
>

Well I can't post the whole program. I thought maybe it was a simple newbie
error. Did you not read my subject line? The error message is " Error
can't find variable: $" just like it says in the message subject line.

Basically I am including this script like this:
<script type="text/javascript" src="date.js"></script>

And like I said, I include it at the bottom of my body. I already include
jQuery like this in my <head>

<script type="text/javascript" src="jquery-1.11.2.min.js"></script>

Other than that I am not sure what you want. I am not even trying to use
the library, simply including it causes the error. And like I said, the
error doesn't happen every time, just about half the time.

It seems like a timing thing, where it is trying to parse the date.js script
before it has parsed jQuery. But besides including Jquery in the head and
this other script in the body, I don't know what to do to make sure the
library gets loaded after jQuery.

Sorry if the question is still unclear.


Andrew Poulos

1/9/2015 2:52:00 AM

0

On 9/01/2015 1:08 PM, Bint wrote:

> Well I can't post the whole program. I thought maybe it was a simple newbie
> error. Did you not read my subject line? The error message is " Error
> can't find variable: $" just like it says in the message subject line.

On my keyboard you can find the $ above the '4' key ie. while press and
holding the Shift key press the '4' key to get the $.

Andrew Poulos

Denis McMahon

1/9/2015 3:04:00 AM

0

On Thu, 08 Jan 2015 20:08:42 -0600, Bint wrote:

> On 1/8/15, 4:00 PM, in article m8mum7$k6e$1@dont-email.me, "Denis
> McMahon" <denismfmcmahon@gmail.com> wrote:

>> 1) Post the code that gives the error 2) If it gives an error message,
>> post the error message message 3) If otherwise it's not doing what you
>> want, tell us (a) what you want it to do and (b) what it actually does.

> Well I can't post the whole program.

Reduce the problem to a minimum example.

eg if you use the following html with the jquery script and the date
formatting script, does an error occur, what is the error?

Error messages usually include a file and source line which triggered the
error.

<!doctype html>
<html><head><title>blah</title>

<script .....><!-- load jquery here --></script>

<script .....><!-- load date formatter here --></script>

</head><body><p>Test</p></body></html>

--
Denis McMahon, denismfmcmahon@gmail.com

Doc O'Leary

1/9/2015 3:12:00 AM

0

For your reference, records indicate that
Andrew Poulos <ap_prog@hotmail.com> wrote:

> On 9/01/2015 1:08 PM, Bint wrote:
>
> > Well I can't post the whole program. I thought maybe it was a simple newbie
> > error. Did you not read my subject line? The error message is " Error
> > can't find variable: $" just like it says in the message subject line.
>
> On my keyboard you can find the $ above the '4' key ie. while press and
> holding the Shift key press the '4' key to get the $.

You. I *like* you.


--
"Also . . . I can kill you with my brain."
River Tam, Trash, Firefly


Thomas 'PointedEars' Lahn

1/9/2015 9:29:00 AM

0

Bint wrote:

> [â?¦] "Denis McMahon" [â?¦] wrote:
>> The problem at the moment is that you have no idea how to ask for coding
>> help:
>>
>> 1) Post the code that gives the error
>> 2) If it gives an error message, post the error message message
>> 3) If otherwise it's not doing what you want, tell us (a) what you want
>> it to do and (b) what it actually does.
>
> Well I can't post the whole program. I thought maybe it was a simple
> newbie error. Did you not read my subject line? [â?¦]

My previous posting was not by mistake. RTFFAQ.

--
PointedEars
FAQ: <http://PointedEars.... | SVN: <http://PointedEars.de...
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-...
Please do not cc me. / Bitte keine Kopien per E-Mail.

Bint

1/9/2015 6:22:00 PM

0


On 1/9/15, 3:29 AM, in article 24084724.g67CNLLCEU@PointedEars.de, "Thomas
'PointedEars' Lahn" <PointedEars@web.de> wrote:

> Bint wrote:
>
>> [?] "Denis McMahon" [?] wrote:
>>> The problem at the moment is that you have no idea how to ask for coding
>>> help:
>>>
>>> 1) Post the code that gives the error
>>> 2) If it gives an error message, post the error message message
>>> 3) If otherwise it's not doing what you want, tell us (a) what you want
>>> it to do and (b) what it actually does.
>>
>> Well I can't post the whole program. I thought maybe it was a simple
>> newbie error. Did you not read my subject line? [?]
>
> My previous posting was not by mistake. RTFFAQ.

So funny you all are. What part of the FAQ do you mean? Do you mind
explaining? I don't see anything at all about jQuery in the FAQ, and
there's nothing about $. (you are talking about the FAQ listed below your
name right?)

If you are just trying to say I didn't write my question correctly, I'm
sorry. I thought it would probably be clear enough to someone with more
experience than me.

As far as making a simple example, I guess I will try that but I have a
feeling it has to do with the amount of code, and timing, and the problem
won't be reproducible. I just thought it was probably a common mistake I
was making.



Tim Streater

1/9/2015 6:26:00 PM

0

In article <D0D5784D.FB4E%bint@ign.com>, Bint <bint@ign.com> wrote:

>On 1/9/15, 3:29 AM, in article 24084724.g67CNLLCEU@PointedEars.de, "Thomas
>'PointedEars' Lahn" <PointedEars@web.de> wrote:
>
>> Bint wrote:
>>
>>> [â?¦] "Denis McMahon" [â?¦] wrote:
>>>> The problem at the moment is that you have no idea how to ask for coding
>>>> help:
>>>>
>>>> 1) Post the code that gives the error
>>>> 2) If it gives an error message, post the error message message
>>>> 3) If otherwise it's not doing what you want, tell us (a) what you want
>>>> it to do and (b) what it actually does.
>>>
>>> Well I can't post the whole program. I thought maybe it was a simple
>>> newbie error. Did you not read my subject line? [â?¦]
>>
>> My previous posting was not by mistake. RTFFAQ.
>
>So funny you all are. What part of the FAQ do you mean? Do you mind
>explaining? I don't see anything at all about jQuery in the FAQ, and
>there's nothing about $. (you are talking about the FAQ listed below your
>name right?)

Possibly because this is not a jquery group, it's a javascript group.
I, f'rinstance, don't know what you mean by $.

--
"Once you adopt the unix paradigm, the variants cease to be a problem - you
bitch, of course, but that's because bitching is fun, unlike M$ OS's, where
bitching is required to keep your head from exploding." - S Stremler in afc

JR

1/9/2015 6:39:00 PM

0

On 08/01/2015 17:17, Bint wrote:
> I tried to add a date formatting script to my html file, and I started
> getting this error -- it doesn't happen every time, though. I was already
> including jQuery in my <head>. I put the new script include at the bottom
> of the <body>, but it still gives me the error. Anyone know what I can do
> to fix it?
>
> I haven't gotten this error when using jQuery on my own -- just once I tried
> to include this date formatter..
>
> Thanks
>

Check this out:
<http://learn.jquery.com/using-jquery-core/avoid-conflicts-other-libr...

--
Joao Rodrigues