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

javascript code is not running, Error: Can't find variable $

I'm just trying to hide a paragraph, this is the code: $(".test").hide();

The console error is showing: Can't find variable $.

And this is the script tag in the html file: <script src="js/script.js"></script> I placed it just above the body closing tag (</body>) Help with this please

2 Answers

Actually, if you are doing something on your own, it could be as simple as not linking a jquery file.

You would need to download jquery file from

https://jquery.com/download/

or put this above your other script file at the bottom above the body tag

<script src="https://code.jquery.com/jquery-1.11.0.min.js" type="text/javascript" charset="utf-8"></script> 

Thank you very much Erik, adding the last line of code solved the problem. Thank you very much again.

Could you please provide the html code.