Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
217,577 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
217,577 Points

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