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

jQuery for selecting a option on drop down

A little help for a jQuery newbie

I have a drop down box on a form with two choices no sealant sealant

When sealant is selected, I want to show the text in a div next to the drop down

here is where I am at:

<select id= "product-select-option-1"></select>
<div class="presealed-text-wrapper" style="display:none;">
           here is the text
</div>
$("#product-select-option-1").change(function(evt) {
      $(".presealed-text-wrapper").show('slow');

the text displays on the page - but it does not function correctly - the "here is text" is always visible and does not change when I change the value

any ideas?

2 Answers

Hi Steve Linn,

I've created a jsFiddle for you.

You're on the right lines, but without seeing your page, it may be that there's an open or closed tag missing or the javascript's got a missing bracket, perhaps.

Let me know if anything doesn't make sense?

Andrew

worked brilliantly - and I learned a great deal - your assistance is greatly appreciated

Very welcome :)