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

Jason Larkin
Jason Larkin
13,970 Points

Traversing and Manipulating the DOM with JavaScript Challenge 1 part 2

I am thoroughly stuck on question #2: making line 14 get the anchor element from inside the listItem. Everything I try, all based upon reviewing the preceding videos and Workspace notes results in an error message.

Can anybody please help put me on the right track?

2 Answers

Hi Jason, the code challenge wants you to get the anchor — a element — from inside the listItem. You can do that using the querySelector, and here's how:

var anchor = listItem.querySelector("a");
Jason Larkin
Jason Larkin
13,970 Points

Thank you Dustin, I hadn't tried that!