In the following code, clicking the input name "goalkeeper" changes another input with the desired value. The problem is that I would like to put another field that automatically calculates the total value (goalkeeper value + technical value), but I can not. Could someone help me?
Script
<script type="text/javascript">
function alterarValor(objeto, valor) {
document.getElementById(objeto).value = valor;
}
</script>
Html:
<input name="goleiro" onclick="alterarValor('valor_goleiro', '5');" value="5" type="radio" id="gol" />
<input name="tecnico" onclick="alterarValor('valor_tecnico', '10');" value="10" type="radio" id="tec" />
Valor do seu goleiro: <input type="text" id="valor_goleiro" value="0" disabled /><br/>
Valor do seu Técnico: <input type="text" id="valor_tecnico" value="0" disabled /><br/>
Valor Total: <input type="text" id="valor_total" value="0" disabled /><br/>