What I am trying to do is to select the alternative and to check with the alert if the answer is right or wrong. Each correct answer is adding the correct answers and if you make mistakes, you will add errors. But when checking the response does not show the alert is sent to the url.
var acertos=0;
var erros=0;
function verificar(){
var form =document.getElementByName('form');
var correctanswer =document.getElementByName("B");
form.addEventListener('onclick', function(event) {
event.preventDefault();
if (correctanswer.checked) {
acertos== acertos++;
alert("Resposta Correta!"+ acertos);
}else{
alert("Resposta Errada!" + erros );
}
});
}
<div class="col-md-10">
<h2>ALFABETO</h2>
<video controls="true" width="500" height="300" id="01" src="video/video1.mp4"></video>
<form name ="form">
<p>Selecione a opção que corresponde a letra sinalizada</p>
<label>
<input type="radio" name="resposta1" value="A"/> Letra A</label>
<label>
<input type="radio" name="resposta1" value="B"/> Letra B</label><br>
<label>
<input type="radio" name="resposta1" value="C"/> Letra C</label>
<label>
<input type="radio" name="resposta1" value="D"/> Letra D</label><br>
<button onclick="verificar()">verificar</button>
</form>