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 trialTobi Farore
Full Stack JavaScript Techdegree Student 2,911 PointsI'm struggling to implement the select element into my code.
I'm just failing to understand how to manipulate the select element to, 1. select a value 2. implement it into the createLi() function. my google search are leaving me confused at the moment
Tobi Farore
Full Stack JavaScript Techdegree Student 2,911 PointsThis is a link to the repo [https://github.com/TobiFarore/rsvp]
1 Answer
Steven Parker
231,248 PointsIn 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
Full Stack JavaScript Techdegree Student 2,911 PointsThank 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 = '';
}
}
}); ```
Steven Parker
231,248 PointsSteven Parker
231,248 PointsPlease show the code you are working with.