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 trialJulianna Kahn
20,702 PointsNot sure why :hidden isn't working.
I assume this would be the pseudo-class but can't check for sure without seeing CSS.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
<link rel="stylesheet" href="style.css" type="text/css" media="screen" title="no title" charset="utf-8">
</head>
<body>
<h2>Star Trek Characters</h2>
<ul class="character-list">
<li>Captain Jean Luc Picard</li>
<li>Data</li>
<li>Worf</li>
<li>Dr. Crusher</li>
</ul>
<div>I am supposed to stay hidden!</div>
<script
src="jquery-3.2.1.min.js"></script>
<script src="app.js"></script>
</body>
</html>
const $hiddenLinks = $('li:hidden')
$hiddenLinks.show
4 Answers
Steven Parker
231,275 PointsYou're really close!
Anytime you call a method, you must put parentheses after the method name, even if no arguments are being passed. And while that would technically be enough to make it work, the challenge also doesn't seem to like the creation of the variable.
So try attaching the ".show()" method directly to the jQuery call with the selector in it.
Julianna Kahn
20,702 PointsI guess I didn't quite understand the first part but I went back and tried it and the challenge didn't like that I didn't create the variable. Also, not quite sure of the syntax. Tried: $hiddenLinks.show('li:hidden'); Also tried adding $ either directly after show or $hiddenLinks.show($('li:hidden'));
Steven Parker
231,275 PointsWhat I was saying is that the challenge dos not like the creation of the "$hinddenLinks" variable. So avoid the variable entirely and try attaching the ".show()" method directly to the jQuery call with the selector in it.
Julianna Kahn
20,702 PointsI tried this: $('.character-list').show('li:hidden'); and this: $('li:hidden').show('.character-list');
I don't know why I am having such a hard time with this.
Steven Parker
231,275 PointsWhere did "'.character-list' come from? It wasn't part of your original solution. And the way the "show" method is being used here it doesn't need any arguments.
Julianna Kahn
20,702 PointsI guess I was thinking that $('li:hidden') had to be selected from the "ul" with the class of .character-list. But the real problem was that I was looking at this for just too long. Took a break, looked at it again, and everything works.
Thanks for your patience.
Julianna Kahn
20,702 PointsJulianna Kahn
20,702 PointsI feel silly that I missed that but it still isn't working. (And I did add the ;) I get the error "Bummer: Unexpected AST node type passed to processExpressionStatement method: VariableDeclaration."
Steven Parker
231,275 PointsSteven Parker
231,275 PointsIt sounds like you're still creating the variable, try my second suggestion. If that's not it, please show the current code.