A very basic question, I'm sure, that I can't seem to crack. What I would like to do is simply trigger a simple event when a specific option in a select menu is picked.
This is the basic SELECT menu item:
<select id="mySelect">
<option value=1>1 - Does not show</option>
<option value=2>2 - Does not show</option>
<option value=3>3 - Does show</option>
</select>
The item to be targeted by the event:
<div id="see-me-now" style="display:none;">Boo!</div>
The JQuery I've got so far:
$(document).ready(function(){
$("#mySelect").change(function(){
$("#see-me-now").fadeIn('slow');
});
});
Now, I know where I'm missing some code, I just can't seem to get exactly what that code is:
$(document).ready(function(){
$("#mySelect").change(function(){
$(*MISSING CODE GOES HERE, I BET*){
$("#see-me-now").fadeIn('slow');
});
});
});
Thanks
What you have done is completely right. But you forgot to add the condition. See the code below:
And also there's an error in your code. The
ifcondition should have a different closing.Snippet