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 JavaScript and the DOM (Retiring) Getting a Handle on the DOM Practice Selecting Elements

Stuck on Challenge Task 1 of 3, at the end of first segment of Javascript and the Dom

Can someone just tell me the answer? I cannot figure out the answer, and the site offers no way for me to move forward without the correct answer, nor will it show me the correct answer so I could review and understand it. I'm at a complete impasse with no way forward. PLEASE!

js/app.js
let navigationLinks = document.getElementsByClassName("nav-list");
let galleryLinks;
let footerImages;
index.html
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Nick Pettit | Designer</title>
    <link rel="stylesheet" href="css/normalize.css">
    <link href='http://fonts.googleapis.com/css?family=Changa+One|Open+Sans:400italic,700italic,400,700,800' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="css/main.css">
    <link rel="stylesheet" href="css/responsive.css">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
  </head>
  <body>
    <header>
      <a href="index.html" id="logo">
        <h1>Nick Pettit</h1>
        <h2>Designer</h2>
      </a>
      <nav>
        <ul>
          <li class="nav-list"><a href="index.html" class="selected">Portfolio</a></li>
          <li class="nav-list"><a href="about.html">About</a></li>
          <li class="nav-list"><a href="contact.html">Contact</a></li>
        </ul>
      </nav>
    </header>
    <div id="wrapper">
      <section>
        <ul id="gallery">
          <li>
            <a href="img/numbers-01.jpg">
              <img src="img/numbers-01.jpg" alt="">
              <p>Experimentation with color and texture.</p>
            </a>
          </li>
          <li>
            <a href="img/numbers-02.jpg">
              <img src="img/numbers-02.jpg" alt="">
              <p>Playing with blending modes in Photoshop.</p>
            </a>
          </li>
        </ul>
      </section>
      <footer>
        <a href="http://twitter.com/nickrp"><img src="img/twitter-wrap.png" alt="Twitter Logo" class="social-icon"></a>
        <a href="http://facebook.com/nickpettit"><img src="img/facebook-wrap.png" alt="Facebook Logo" class="social-icon"></a>
        <p>&copy; 2016 Nick Pettit.</p>
      </footer>
    </div>
  <script src="js/app.js"></script>
  </body>
</html>
Blake Larson
Blake Larson
13,014 Points

The hint is to use the descendant selector which is a space followed by your target(s) which is all links in the nav.

let navigationLinks = document.querySelectorAll('nav a');

Using nav a is done so you don't grab the anchors you don't need like the as in the gallery ul.

If you want a little more practice ---> https://www.w3schools.com/css/css_combinators.asp

Thank you Blake. I tried selecting ('nav li') which was incorrect, but was not told why exactly it was incorrect, nor offered any other option other than to try again. For the record, it is extremely, EXTREMELY irritating that Treehouse does not offer any other way to see simply see the answer in the event you get stuck. You cannot move on from a question without getting it right. God damn it.

Blake Larson
Blake Larson
13,014 Points

Just to add on, you can search the specific challenges or videos in the community that have most likely been asked in the past and will have detailed answers on how to pass it.

In the community you can click the buttons that lead to similar questions. This one would be JavaScript > JavaScript and the DOM > Getting a Handle on the DOM > Practice Selecting Elements, and that will filter out the questions so it's all the questions in this track or this specific challenge set.

1 Answer

Steven Parker
Steven Parker
231,271 Points

It looks like Blake already addressed your issue, but you should know how to skip ahead if you get stuck.

You can skip a challenge (or any course step) by clicking on the next circle on the progress bar that goes across the top of the page. The current page is represented by the circle with the ring around it.

If you're on the very last circle, you can skip to the next stage by going back to the course index using the link at the top left (above the bar with the circles). From there, you can go directly to any page in the course.

Thank you Steven for replying. I do know you can skip the entire segment, but you cannot complete a challenge segment or be shown the answer unless you get it correct.

Steven Parker
Steven Parker
231,271 Points

The challenge itself may remain incomplete, but it won't hold you up. Sometimes if you move on, you'll learn something in later lessons that will allow you to come back later and complete the challenge.