I want to have jQuery show div id=\'business\' only if \'business use\' is selected in the dropdown box.
This is my code:
https://www.tutorialrepublic.com/codelab.php?topic=faq&file=jquery-show-hide-div-using-select-box It's working well in my case
$(document).ready(function(){
$("select").change(function(){
$(this).find("option:selected").each(function(){
var optionValue = $(this).attr("value");
if(optionValue){
$(".box").not("." + optionValue).hide();
$("." + optionValue).show();
} else{
$(".box").hide();
}
});
}).change();
});
jQuery Show Hide Elements Using Select Box
You have selected red option so i am here
You have selected green option so i am here
You have selected blue option so i am here