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) Making Changes to the DOM Styling Elements

The hide button isn’t working

I followed the steps exactly, but my button doesn’t hide the list. For me, the “=>” in the function is orange instead of black like in the video. Does that make a difference? Thanks.

Quinton Shuman
Quinton Shuman
7,068 Points

I believe the orange is just how the text editor they give you indicates to you that it is a function.

Post the snippet of the whole code, you might have missed something trivial (as I do very often :D ).

1 Answer

Same issue too!

const toggleList = document.getElementById('toggleList'); const listDiv = document.querySelector('.list'); const input = document.querySelector('input'); const p = document.querySelector('p.description'); const button = document.querySelector('button');

toggleList.addEventListener('click', () => { listDiv.style.display = 'none'; });

button.addEventListener('click', () => { p.innerHTML = input.value +':' });

under my addEvent it is not showing up as the same color as the rest of the line.