0
I am trying to make the message window.Alert('A checked') only appear when the three checkbox with the name="right" is marked.
HTML5
<input type="checkbox"  class="resposta" name="certo">
<label>Abrir portas para um futro promissor.</label><br>
<input type="checkbox"  class="resposta" >
<label>Ganhar dinheiro.</label><br>
<input type="checkbox"  class="resposta" name="certo">
<label>Expandir minha rede de contatos profissional.</label><br>
<input type="checkbox"  class="resposta">
<label>Diminuir o desmatamento.</label><br>
<input type="checkbox"  class="resposta" name="certo">
<label>Promover meu trabalho.</label><br>
<input type="button"  value="Verificar" onclick="verificar()">
Javascript
function verificar(){
    let resposta = document.querySelector('.resposta')
    let correto = document.getElementsByName('certo')
    for (var marcado in resposta) {
        if(resposta[marcado].checked){
            window.alert('Marcada')
            if(correto == true){
               return window.alert('A certou')
            }else{
                return window.alert('Errou')
            }
        }
        else
        return window.alert('Em branco')
    }  
}
Thanks Hiago-buzz, I hadn’t even thought to make a separate Function to go through the right input. :)
– Estevam