Reputation: 317
I want my class of .fein to show when "llc" is selected from the dropdown but it is not working.
http://jsfiddle.net/0c7952hs/1/
<select>
<option value="corporation">Corporation</option>
<option value="llc">LLC</option>
<option value="partnership">Partnership</option>
</select>
<div class="fein">
<label for="fein">FEIN</label>
<input type="password" name="fein" />
</div>
and the jquery:
$("option").change(function () {
if ($(this).val() == "llc") {
$('.fein').show();
} else {
$('.fein').hide();
}
});
Upvotes: 0
Views: 22
Reputation: 312
When I've done something similar, I hide the element using JavaScript onload instead of hiding it with CSS initially. I suggest starting there. In addition, you're not changing the options, you're changing the select, you should be referencing that.
Upvotes: 0