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

As soon as I add the for loop to go to dynamically add the buttons to the existing list all the code below stops working

I have been following Guil's code through out this course and everything work great to the point where I add the for loop to create and append dynamically the buttons to the existing list items and then it stops working.

if anyone can take a look at my code and figure out what goes wrong this will be greatly appreciated.

there is a link to the codepen playground where I implemented the entire code from this course http://codepen.io/RonGootman/pen/bBjvPw?editors=1010

note that the for loop for attachListItemButtons(lis[i]); is currently commented out and everything works well but as soon as I uncomment it and have it in my code everything below stops functioning

2 Answers

Mike Henry
PLUS
Mike Henry
Courses Plus Student 5,373 Points

It looks like your for loop has a problem. // for (let i = 0 ; 0 < lis.length ; i++) { // attachListItemButtons(lis[i]); // } should be for (let i = 0 ; i < lis.length ; i++)

Coding is unforgiving, one small mistake and entire code goes wrong.. THANKS SO MUCH

Ned Redmond
Ned Redmond
5,615 Points

i made an identical typo! weird