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 DOM Scripting By Example Improving the Application Code Next Steps

1 Answer

Steven Parker
Steven Parker
231,275 Points

In app.js, on line 119:

        if (select) {                           // old: this only checks that "select" exists
        if (select.value != "Not Responded") {  // fix: this checks if a response was selected

And before assuming that the change event was triggered by the select, you should check the tag like you do for "BUTTON" on line 127.

Tobi Farore
seal-mask
.a{fill-rule:evenodd;}techdegree
Tobi Farore
Full Stack JavaScript Techdegree Student 2,911 Points

Thank you, updated the handler

``` ul.addEventListener('change', (e) => { if ( e.target.tagName === 'SELECT') { const select = e.target; const listItem = select.parentNode;

    if (select.value != 'Not Responded') {
        listItem.className = 'responded';
    } else {
        listItem.className = '';
    }
}
}); ```