Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.