1
I got a problem I can’t fix.
I need a div to be shown ONLY after 3 radio Buttons have been checked, but it’s not working. I’m only getting through with one option, but it has to be the 3 at a time and only after the 3 one has to appear the div.
$(function() {
$('.control').on('click', function(){
var n1 = $('#profissional-nao:checked');
var n2 = $('#institucionalizada-nao:checked');
var n3 = $('#indigena-nao:checked');
if(n1.length > 0 && n2.length > 0 && n3.length > 0) {
document.getElementById("fase-dois").style.display = 'block';
} else {
document.getElementById("fase-dois").style.display = 'none';
}
});
});
<div class="">
Profissional de Saúde: <br>
<input id="profissional-sim" name="{$q2_name}" type="radio" value="Sim" checked="" class="form-control"> Sim
<input id="profissional-nao" name="{$q2_name}" type="radio" value="Não" class="form-control control"> Não
</div>
<div class=""><br><br></div>
<div class="">
Pessoa Institucionalizada?: <br>
<input id="institucionalizada-sim" name="{$q3_name}" type="radio" checked="" value="Sim" class="form-control"> Sim
<input id="institucionalizada-nao" name="{$q3_name}" type="radio" value="Não" class="form-control control"> Não
</div>
<div class=""><br><br></div>
<div class="argem">
Poulação Indigena ou em Terras Demarcadas?: <br>
<input id="indigena-sim" name="{$q4_name}" type="radio" value="Sim" checked="" class="form-control"> Sim
<input id="indigena-nao" name="{$q4_name}" type="radio" value="Não" class="form-control control"> Não
</div>
<div class=""><br><br></div>
<div class="col-xs-12" id="fase-dois" style="display: none;">teste</div>
Thanks for your answers, but it’s not working yet. I must be doing something wrong. $(Function() { $('. control'). on('click', Function(){ if(Document.getElementById('professional-non'). checked && Document.getElementById('institutionalized-not'). checked && Document.getElementById('indigena-nao'). checked){ Document.getElementById("phase-two").style.display = 'block'; }Else{ Document.getElementById("phase-two").style.display = 'None'; }; }); });
– Day