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 trialShikhar Singh
8,418 PointsjQuery - hide() isn't functioning!
I added this line of code :- " jQuery(".warning").hide(); " to app.js in the workspace, but it fails to hide the 'warning' (It's a Trap).
//Here is the HTML file (index.html)
<!DOCTYPE html>
<html>
<head>
<title>Take Evasive Action</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" title="no title" charset="utf-8">
</head>
<body>
<p class="warning">
<span>It's A Trap!</span>
</p>
<div class="image">
<img src="img/ackbar.gif" />
</div>
<script src="http://code.jquery.com/jquery-1.11.0.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/app.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>
Shikhar Singh
8,418 Points <!DOCTYPE html>
<html>
<head>
<title>Take Evasive Action</title>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" title="no title" charset="utf-8">
</head>
<body>
<p class="warning">
<span>It's A Trap!</span>
</p>
<div class="image">
<img src="img/ackbar.gif" />
</div>
<script src="http://code.jquery.com/jquery-1.11.0.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/app.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>
Shikhar Singh
8,418 PointsjQuery(".warning").hide(); //in app.js
5 Answers
adamdonatello
27,485 PointsHi Shikhar,
Can you post your HTML and jQuery code?
elk6
22,916 PointsIt looks like you gave the correct answer but it got deleted. Might be you deleted it yourself.
I changed this comment to an answer and marked it as "best" so you get your points for providing a best answer. :)
Shikhar Singh
8,418 PointsIt worked!! (without any changes)
Shikhar Singh
8,418 PointsThanks! adamdonnatello (for your time)
Ankit Prasad
1,677 PointsI was running into the same issue, but pressing doing a hard refresh (by pressing Shift + refresh button in Chrome) fixed it.
Jeffrey Eng
2,555 PointsLooks like the Treehouse workspace text editor doesn't like single-quotes around the .warning
class . I had previously wrote the code $('.warning').hide();
with single-quotes, then replaced the single-quotes with double-quotes and it worked. Go figure...
Thomas Katalenas
11,033 Pointsworks in chrome for me
adamdonatello
27,485 Pointsadamdonatello
27,485 PointsThat's not giving me anything. Can you post your code following the Markdown Cheatsheet?