1
I made the following condition:
jQuery:
$( "#selectOption" ).click(function() {
var option = $( "#selectOption option:selected" ).val();
if(option!='escolha'){
if(option==2){
$( "#atendimento_a" ).remove();
$( "#locais_de_atendimento" ).remove();
$( "#dias_de_atendimento" ).remove();
}
if(option==3){
$( "#atendimento_a" ).remove();
$( "#locais_de_atendimento" ).remove();
$( "#dias_de_atendimento" ).remove();
$( "#eu_adoro" ).remove();
}
}
});
Form:
<select id="selectOption" name="selectOption">
<option>escolha</option>
<option value="1">destaque</option>
<option value="2">mini</option>
<option value="3">free</option>
</select>
If the return of the select of options is 2 or 3, I remove the Divs in question, as I do to ADD the Divs again, if the option is option 1? Without being duplicated or something in this sense??
Have you ever tested
.remove()
use.hide()
and.show()
?– Sergio
If you need to switch, maybe it’s better to just hide instead of remove.
– Bacco
It’s an option! I’ll test! :)
– Sr. André Baill
Just, solved my problem, thank you!
– Sr. André Baill
@Great Andrébaill. I put together an answer with the most compressed code.
– Sergio