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 Using previousElementSibling and insertBefore

Rod R
Rod R
3,050 Points

my 'up' buttons are removing list items instead of moving up

https://w.trhou.se/ee3rmjnk3n

I've reviewed the code multiple times and compared with the video, and there's no JS console error, but the UP buttons are removing items. Where's the error?

1 Answer

Try == or ===?

//original line 13
 if (event.target.className="remove") {

//fixed
if (event.target.className == "remove") {

//You got it right in line 18
if (event.target.className == "up") {

I'm sure you know what the single = does from the rest of your code, so I am assuming you don't need me to explain that you are trying to assign "remove" to event.target.className. I am assuming it's just a typo.