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 Getting the First and Last Child

Victor Evangelista
Victor Evangelista
18,688 Points

My Solution for JavaScript List (Need a little assistance with button flicker issue)

Here is my solution: https://w.trhou.se/m63kdejjz3

I am working with most of the original code. I've added two new functions:

const buttonDisabler

const buttonReset

Whenever the user adds a new list item, the button will flicker for a quick moment before its replaced by a button without the disabled styling.

1 Answer

Steven Parker
Steven Parker
231,271 Points

To avoid "flashing", make sure that the buttons are all in the desired state before the new list item is added to the DOM. Otherwise, there will always be a moment between when the list item is added and the states are reset where the default appearance might be seen.