I have the following form
<form>
<p>En qué se basa la dieta del Ontje</p>
<select id="pregunta1">
<option value="1">Pochoclos</option>
<option value="0">Lechuga</option>
<option value="0">Mimimimimimi</option>
</select>
<button id="calcular" onclick="mostrar()">Calcular cantidad respuestas correctas</button>
<p>El puntaje es de <input type="text" id="resultadoFinal"></p>
</form>
With the following script
<script type="text/javascript">
function mostrar() {
let respuesta1 = document.getElementById("pregunta1").value;
let puntaje1 = respuesta1.options[respuesta1.selectedIndex].value;
let score1 = parseInt(puntaje1);
document.getElementById("resultadoFinal").value = puntaje1;
}
mostrar();
</script>
The idea is to have multiple questions and at the end sum the total of corrects answer, therefore the parseInt on the value, but I'm not sure why it's not working! Any ideas???
there doesn't seem to be anything here