0
Select code
<select name="category" class="form-control" id="category">
<option value="">Escolha uma categoria</option>
<optgroup label="Vehicle">
<option value="2">Aircraft</option>
<option value="3">Automotive Items & Parts</option>
<option value="4">Boats & Watercraft</option>
<option value="5">Cars</option>
<option value="6">Classic Cars</option>
<option value="7">Commercial Trucks & Tractor Trailers</option>
<option value="8">Off Road Vehicles</option>
<option value="9">RV & Motorhomes</option>
<option value="10">SUVs</option>
<option value="11">Utility & Work Trailers</option>
<option value="12">Vans</option>
</optgroup>
<optgroup label="Sevices">
<option value="2">Automotive Services</option>
<option value="3">Beauty & Salon Services</option>
<option value="4">Caregivers & Baby Sitting</option>
<option value="5">Cleaning Services</option>
<option value="6">Construction & Remodeling</option>
<option value="7">Financial Services</option>
<option value="8">Health & Wellness</option>
<option value="9">Home Services</option>
<option value="10">Insurance</option>
<option value="11">Office Services</option>
<option value="12">Real Estate Services</option>
</optgroup>
<optgroup label="Pets">
<option value="2">Birds</option>
<option value="3">Cats</option>
<option value="4">Dogs</option>
<option value="5">Fish & Reptile Pets</option>
<option value="6">Free Pets to Good Home</option>
<option value="7">Horses</option>
<option value="8">Pet Supplies</option>
</optgroup>
</select>
Personal to div below is only displayed if you select category x for example
<div id="x">
bla bla bla
</div>
Follows js file
$("#x").hide();
$('#subcategorias').change(function(){
var valor = $(this).val();
if(valor){
if(valor == 3){
$("#x").show();
}
}else{
$("#x").hide();
}
});
If I change to category "y" I wanted you to open the div for "y" but hide the div "x".
How do I do it?
Thank you!
Post the code of your
select
also.– abfurlan