Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Query is not working offline

I am trying to use Jquery while outside without wifi. I downloaded jquery the uncompressed, development jQuery 1.11.2 , but is not working offline. I am not sure if I can use it offline or I need internet connection. Each time I run the code in the browser, I get this error code ReferenceError: $ is not defined. When I try using Google Cdn, my code worked well. Thank you

<script src="js/myjs.js"></script>
 <script src="js/jquery-1.11.2.js"></script>
$(document).ready(function(){
     alert("Hello world!");

});

2 Answers

You must include jquery before your javascript file so that it has everything defined and loaded for you to use.

Hope this helps

oh, thank you very much I didn't know that.