JavaScript JavaScript and the DOM 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
172,034 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".