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

Down button works but 'up' button replicates 'down' button's behavior.

Snapshot: https://w.trhou.se/bx2l1j3paf

I implemented down button with the help of nextElementSibling but now the 'up' button is messed up and doesn't work correctly.

It seems like both the buttons('up' and 'down') have the same behavior.

1 Answer

Steven Parker
Steven Parker
229,786 Points

On line 28 of app.js, you have an assignment operator ("=") instead of a comparison operator ("=="). So when this expression is evaluated, instead of testing if the button has the class "down", it changes the class to "down".

Fix that comparison and then the "up" buttons will actually go "up".