<script href=".10.2.min.js"></script>
<script>
console.log($);
console.log(jQuery);
</script>
I get a message that $
or jQuery
is undefined: what’s wrong?
It’s just an empty index.html, with no other code.
<script href="http://code.jquery./jquery-1.10.2.min.js"></script>
<script>
console.log($);
console.log(jQuery);
</script>
I get a message that $
or jQuery
is undefined: what’s wrong?
It’s just an empty index.html, with no other code.
Share Improve this question edited Jun 23, 2014 at 18:21 Guja1501 1,0288 silver badges16 bronze badges asked Jan 21, 2014 at 20:40 yeah its meyeah its me 1,1414 gold badges20 silver badges29 bronze badges 6- If you want a hosted version of jQuery you might want to use a CDN version. – tadman Commented Jan 21, 2014 at 20:42
- @tadman use googles url for it. – Shawn Commented Jan 21, 2014 at 20:43
- 2 @tadman That IS a CDN version. MaxCDN – Kevin B Commented Jan 21, 2014 at 20:43
- @KevinB Right you are. I thought that was the download link pasted in there. – tadman Commented Jan 21, 2014 at 20:43
- And, by using MaxCDN, it won't be blocked by panies (or countries) that block google-related traffic. – Kevin B Commented Jan 21, 2014 at 20:45
3 Answers
Reset to default 25You used the href
attribute to include the script to the file.
href
is an invalid attribute for <script></script>
tags. Use src
instead...
<script src="http://code.jquery./jquery-1.10.2.min.js"></script>
You have an error in your declaration. You should use
<script src="...">
instead of
<script href="">.
<script src="http://code.jquery./jquery-1.10.2.min.js"></script>
<script>
console.log($);
console.log(jQuery);
</script>
Always try to use js files on your local machine.