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

JavaScript jQuery Basics Working with jQuery Collections Working with jQuery-Specific Selectors

Akshay Alok
Akshay Alok
7,857 Points

I need help with jQuery's syntax

I wanted to select an li element which was being hidden by CSS, and then display it using jQuery. I know I must be doing something really stupid so I apologize in advance...

<!DOCTYPE html>
<html lang="en">
    <link rel="stylesheet" href="style.css" type="text/css" media="screen" title="no title" charset="utf-8">
    <h2>Star Trek Characters</h2>

    <ul class="character-list">
        <li>Captain Jean Luc Picard</li>
        <li>Dr. Crusher</li>

    <div>I am supposed to stay hidden!</div>    

    <script src="app.js"></script>
let $hidden = $('li:hidden');

2 Answers

Pascal Breitrück
Pascal Breitrück
Courses Plus Student 3,206 Points

Hey Friend,

The jQuery Syntax for this is $("li:hidden").show();

Greets Pascal

Akshay Alok
Akshay Alok
7,857 Points

Yeah, I saw the same thing in another question, and it worked!

But I still don't know why my code didn't.

Pascal Breitrück
Pascal Breitrück
Courses Plus Student 3,206 Points

I think it is a bug your code should work. Because your code is fine .