2
Well, I’ve tried everything I know to fix this, but I couldn’t, so could someone help me? When clicking on the "Boleto" and selecting a quantity, clicking on the Finalize, an action would occur where it takes the amount that was chosen and multiplied by 32, then it should return to the "Return" and come in Alert. Follows the code:
function valorAPagar(){
var j = 0;
if(document.getElementById("forma1").checked==true){
j = (document.getElementById("inte") * 32);
return j;
}
alert(valorAPagar());
}
<input type="checkbox" id="forma1" value="Boleto">Boleto<br>
<input type="checkbox" id="forma2" value="Cartão de Crédito">Cartão de Crédito<br>
Entrada Inteira: <input type="number" id="inte"><br>
Meia Entrada: <input type="number" id="mei"><br>
<input type="submit" value="Finalizar" onClick="valorAPagar()">`
The Return terminates the function and does not arrive in the Alert that comes after. If you get to Alert, you will loop infinitely because you are calling the function itself within it.
– Sam
Right, so what could I do to have this Lert on the screen with the result(value) to pay?
– Gabriela