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

Can't work this out - have tried everything and cannot get the solution to this question?!

Have tried all sorts of different ways to complete the first step in this code challenge and am not getting anywhere - any sort of walkthrough help would be amazing. Thank you! e.g. is it using document.querySelectorAll() and is there use of nth-child selector here?

1 Answer

Steven Parker
Steven Parker
231,269 Points

You're close, the "document.querySelectorAll()" function will be useful for all three tasks. But you won't need any pseudo-classes in the selectors.

All three tasks can be fulfilled using descendant selectors, where both a container and a target are named with a space in between.

Thanks - this was super helpful!