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

alborz
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
alborz
Full Stack JavaScript Techdegree Graduate 30,885 Points

Default selected option remains displayed despite separate option being selected which filters the next select options

My GitHub: https://github.com/amesbahi/interactive-form

I have an interactive form. When I select a certain t-shirt design, the options on the color select are automatically filtered. I've managed to filter the color options once a t-shirt design is selected, however there's a problem: when I filter the color options, the default selected option for the color ("cornflowerblue") still remains displayed, but when I select the color menu it displays as the filtered colors -- click the dropdown again and the options disappear but the default color option remains as selected despite which ever design option is selected.

Caleb Kleveter
Caleb Kleveter
Treehouse Moderator 37,862 Points

Sorry Alborz, but I am not advanced enough in JS to answer this question. Hope you get your answer!

1 Answer

alborz
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
alborz
Full Stack JavaScript Techdegree Graduate 30,885 Points

I figured it out -- I just need to grab the first option according to the design and just set it to display the option per its index.