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!
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

Łukasz Czuliński
8,646 PointsJS not working at all. Path error? Missing something simple here.
For some reason my JavaScript is not responding at all. I've double checked the path name, all the element names, etc and everything seems to be in order. Even a simple alert(); doesn't appear if I load index.html. Does anyone see anything wrong here?
Here's my html section I'm trying to affect:
<div id="spwrap">
<p class="spoiler"><span>Darth Vader is Luke's father.</span></p>
</div>
Here are my JS paths:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="JS/lesson1.js" type="text/javascript"></script>
And here is my JS, where nothing happens at all (even a simple alert function doesn't appear when index.html loads):
$('.spoiler span').hide();
$(".spoiler").append("<button>SPOIL</button>">);

Łukasz Czuliński
8,646 PointsSilly me, didn't even think about that (js noob here).
In the console, I'm getting:
GET file://code.jquery.com/jquery-1.11.0.min.js net::ERR_FILE_NOT_FOUND
Strange that this isn't working, as I also tried the Google CDN with the same result.
and also a:
Uncaught SyntaxError: Unexpected token )
which is referring to this line (don't see any errors in the syntax):
$("#spwrap").append("<button>SPOIL</button>">);
2 Answers

Gareth Borcherds
9,372 PointsYou need to put te full URL if you are using the google CDN. So put the http: in from of the URL.

Łukasz Czuliński
8,646 PointsWow, ok. Embarrassing oversight! Thanks.
That's done and the first error message is gone, but I still have that strange syntax error for the second part.

Gareth Borcherds
9,372 PointsYou have an extra > after the " and before the ); at the end of that line.

Łukasz Czuliński
8,646 PointsThanks Gareth. Appreciate the help. That's what I get for trying to practice code before 7am and coffee.
Gareth Borcherds
9,372 PointsGareth Borcherds
9,372 PointsHave you looked at the errors that might be present in the console?