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) Traversing the DOM Getting All Children of a Node with children

Ioana Rusu
Ioana Rusu
9,599 Points

[SOLVED] Don't know what to do in this situation

I have done everything, just like Guil and when I refresh the page, the buttons don't show up on the page - as we used a for loop to add them to the existing elements . When I look into the console, it says that "lis" not defined. Guil uses it and works just fine so...why mine doesn't ! Please help :) This is the loop :

for( let i = 0; i < lis.length; i ++ ) { attachListItemButtons(lis[i]); }

Mod Note... just a slight edit to indicate the question has been solved. :)

Ioana Rusu
Ioana Rusu
9,599 Points

SOLVED !

Forgot to define lis with const ! One line of code and everything goes to waste !

Thank you anyway :)

Steven Parker
Steven Parker
231,261 Points

Congrats. And an excellent example of why it's important to show all the code and not just a tiny snippet.

1 Answer

Ioana Rusu
Ioana Rusu
9,599 Points

Hi Steven. Yes you are right, next time i will include all code so it can be clearer Thank God I have decided to look over the code again and try and figure out myself :)

Steven Parker
Steven Parker
231,261 Points

You can give yourself a "best answer" as a reward for resolving your own issue. :wink: