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

Leroy Klotz
Leroy Klotz
2,814 Points

Am I in the wrong course?

I have followed the javascript suggested learning path and I´m currently watching lessons that seem to go at more than three times the speed of what I´ve been doing so far. The quizzes are asking even more difficult things than what is presented in the video´s.

Am I in the wrong course? Should I stop this course and do some other course first? I´ve been trying to find the answer to the quiz question for a very long time now. Re-watched the video 3 times and tried everything I can possibly think of with help of the mozilla developer network..

It´s been going a lot faster than what is comfortable for the last 3 or 4 lessons, I´m not sure whether this is normal or not but I really feel like I´ve skipped an entire course about html.

Any thoughts?

Steven Parker
Steven Parker
231,271 Points

Which courses have you already completed?

Leroy Klotz
Leroy Klotz
2,814 Points

Steven Parker I have completed the following courses:

  • Introducing JavaScript
  • JavaScript Basics
  • JavaScript Loops, Arrays and Objects
  • The Landscape of JavaScript
  • Getting Started With ES2015

The next suggested course (which I´m clearly struggling with) is:

  • JavaScript and the DOM

It´s introducing many HTML elements that have not been discussed previously and despite the fact that it´s extremely interesting I feel like I´m lacking HTML knowledge.

1 Answer

Dimitar Dimitrov
Dimitar Dimitrov
11,800 Points

My advice is to check some HTML basics and CSS selector courses just to get familiar what are selectors and how they works before going deeper with the ways JavaScript traverse through the DOM and manipulates it. And this is the answer of the 1st question in the quiz:

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

I use descendant selector to select all links in the <nav> element

Leroy Klotz
Leroy Klotz
2,814 Points

Thank you Dimitar, I will follow your advice.

As for the answer, I guess I got close.. I tried: let navigationLinks = document.querySelectorAll("nav li"); & let navigationLinks = document.querySelectorAll("nav li a"); & let navigationLinks = document.querySelectorAll("nav.li"); & let navigationLinks = document.querySelectorAll("nav.li.a"); & let navigationLinks = document.querySelectorAll(".nav li"); & let navigationLinks = document.querySelectorAll(".nav li a"); & let navigationLinks = document.querySelectorAll(".nav.li"); & let navigationLinks = document.querySelectorAll(".nav.li.a"); & let navigationLinks = document.querySelectorAll("nav li ahref"); & let navigationLinks = document.querySelectorAll("nav.li.ahref"); & let navigationLinks = document.querySelectorAll(".nav.li.ahref"); & let navigationLinks = document.querySelectorAll("li"); & let navigationLinks = document.querySelectorAll(".li");

.. and maybe a few more even. As you can see, it was just guessing basically, which is definitely not what I want to be doing. I´ll follow your advice and check out some HTML and CSS. It seems strange to me that this is the next suggested course in the learning path though.