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

Sandra Vilaro Casas
Sandra Vilaro Casas
2,698 Points

Error in 2nd Challenge of the badge introduction jQuery

I don't understand why is not running my code in this challenge. Maybe there's a bug? anyone can help me?

code challenge: http://teamtreehouse.com/library/websites/build-an-interactive-website/introduction-to-jquery/including-jquery-in-our-project-2

instructions:

hide the div with the id "message" and then show it slowly by passing in the string "slow".

my code:

$(".message").hide().show("slow");

3 Answers

Sandra Vilaro Casas
Sandra Vilaro Casas
2,698 Points

Thanks so much Mike! The exercise said to place the code in the 2nd script tag (without specifications) so I placed it in the 2ond script tag which was in the line 21. (I created already a script tag in line 4 for the jQuery link). Seems that the 2nd script tag is in line 23 not 21, though, because they were talking about the 2nd script in the body, not in the html.

James Barnett
James Barnett
39,199 Points

Here's a hint, classes are referenced with a . and ids with a #, so double check which you are supposed to be using.

Sandra Vilaro Casas
Sandra Vilaro Casas
2,698 Points

Sorry again... I just did the correct id (#) but still having an error --> $("#message").hide().show("slow");

Mike Kohl
Mike Kohl
Courses Plus Student 6,793 Points

Your code should work: $("#message").hide().show("slow");

My question for you is.. where did you place that code?

Make sure you place it between the last <script> tags. If you put it between the first <script> tags you will receive the error message.

Mike Kohl
Mike Kohl
Courses Plus Student 6,793 Points

sorry the forum stripped some of my comment..

Make sure you place it between the last "script" tags. If you put it between the first "script" tags you will receive the error message.