How to show div upon clicking drop down box
I have a开发者_Go百科 drop down box with yes and no values. By default it's set to 'No' however when we select the value of yes another div should appear. Please help
$('#IdOfYourDropDown').change(function(){
if($(this).val() == 'Yes'){
$('#IdOfYourDiv').show();
}
else{
$('#IdOfYourDiv').hide();
}
});
$('#my_dropdown_id').bind('change', function(){
switch($(this).val().toLowerCase()){
case 'yes':{
$('#my_show_id').show();
break;
}
case 'no':{
$('#my_show_id').hide();
break;
}
}
});
You can extend that switch statement
with any other value you might want to test for.
精彩评论