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 jQuery Basics Working with jQuery Collections Working with jQuery-Specific Selectors

We did not learn about :hidden pseudo class yet but it is one of the tasks

I am being asked to show some hidden content and keep a div element hidden with a :hidden pseudo-class but I haven't be taught how to do this yet

index.html
<!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>
app.js
li:hidden

This is what it is asking me to do: CSS is being used to hide three items on the index.html page (two <li> elements and a <div> element). Use jQuery's :hidden pseudo selector and the show() method to display the hidden <li> elements, while leaving the <div> element hidden.

2 Answers

Armin Kadic
Armin Kadic
16,242 Points

Hmm... I can't remember if we did learn it or not. What I do is experiment or do a quick google search to find the answer, that is actually recommended to do. In case you need the answer I will write it under this text.

SPOILER ALERT!

$("li:hidden").show();

So what you do is select the hidden list item, don't put a space between "li" and ":hidden", and then you just ".show" it... I hope this helps!

I actually just did that! Thank you. I'm just wondering if it is a bug or if I have to report a problem? I looked back at the video (there was only one before the task) and it said nothing about pseudo classes.

Armin Kadic
Armin Kadic
16,242 Points

I'm glad you got it figured out! I don't think it's a problem because we will encounter many situations like this in coding that we are not prepared for (they can't teach us EVERYTHING), instead we need to find a solution to the problem on the internet. That's how everyone does it I believe. No stress and happy coding! :)