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 Solution: Using nextElementSibling

angelod
angelod
6,694 Points

down button is not working and need help understanding

https://w.trhou.se/j0fv6586fl

when I view the other buttons work but down button doesn't.

also can someone help me understand what's happening. cause I'm second guessing my self on understanding all this. please thank you

1 Answer

Steven Parker
Steven Parker
231,261 Points

The test that checks for a "down" button is currently inside that code block for the "up" button, so that condition will never be true and the code will never run. These two sections of code should be peers instead of nested.

One way to fix it would be to move the close brace from line 34 and place it between lines 23 and 24.