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

Selection certain options with jquery

I am trying to select an option with jquery, but the placeholder "select theme" is always the first one in the drop down. Even when it is hidden after being clicked, its still logging out "select theme". When i click out of the drop down and click it again, the value of whatever is in the box is logged and i cant find out how to log what I want based on the first click without having to deal with the "select theme" being logged to the console.

Js Repo: https://github.com/joeEscob1023/interactiveForm/blob/master/js/app.js

1 Answer

Steven Parker
Steven Parker
243,266 Points

Instead of ".click()", try using ".change()". Then the handler will only be called when a different selection is made.

Thank you so much!