I need help. In my html programming I have 3 boxes, each box contains 3 hidden inputs with (display "none"), each input has a respective button, which serves to show or display that hidden input. The point is that I want the last input of each box to be added, that is, if the box one has only one input displayed, and the second box has 2 inputs, and the third has its three inuts displayed, then, I will add the first input of box one, plus the second input of box 2, plus the 3 input of box 3, what I want is to add the last inputs of each box, if the 3 boxes have their three inputs displayed, They will add the third or last input of each box. In a few repetitive words, the last input of each box will be added, if a box has only one input displayed, since that input will be added with the last input of the other box. This is urgent, please I need help, I would not have to pay to help me.
Here I attach my code for you to see and please beg me to help:
<!DOCTYPE html>
<html>
<head>
<title>Sumando Cajas</title>
<script type="text/javascript">
function apa1() {
document.getElementById('input1').style.display = "block";
}
function apa2() {
document.getElementById('input2').style.display = "block";
}
function apa3() {
document.getElementById('input3').style.display = "block";
}
function apa4() {
document.getElementById('input4').style.display = "block";
}
function apa5() {
document.getElementById('input5').style.display = "block";
}
function apa6() {
document.getElementById('input6').style.display = "block";
}
function apa7() {
document.getElementById('input7').style.display = "block";
}
function apa8() {
document.getElementById('input8').style.display = "block";
}
function apa9() {
document.getElementById('input9').style.display = "block";
}
function apa10() {
document.getElementById('input10').style.display = "block";
}
</script>
</head>
<!--Tengo tres cajas, cada caja contiene 3 inputs ocultos, con botones para aparecerlos-->
<div>
<h1>Primera caja:</h1>
<button onclick="apa1()">Aparecer input1</button><br>
<input type="text" placeholder="numero 1" name="" id="input1" style="display: none;"><Br>
<button onclick="apa2()">Aparecer input2</button><br>
<input type="text" placeholder="numero 2" name="" id="input2" style="display: none;"><Br>
<button onclick="apa3()">Aparecer input3</button><br>
<input type="text" placeholder="numero 3" name="" id="input3" style="display: none;"><Br>
</div>
<div>
<h1>segunda caja:</h1>
<button onclick="apa4()">Aparecer input4</button><br>
<input type="text" placeholder="numero 4" name="" id="input4" style="display: none;"><br>
<button onclick="apa5()">Aparecer input5</button><br>
<input type="text" placeholder="numero 5" name="" id="input5" style="display: none;"><br>
<button onclick="apa6()">Aparecer input6</button><br>
<input type="text" placeholder="numero 6" name="" id="input6" style="display: none;"><br>
</div>
<div>
<h1>Tercera caja:</h1>
<button onclick="apa7()">Aparecer input7</button><br>
<input type="text" placeholder="numero 7" name="" id="input7" style="display: none;"><br>
<button onclick="apa8()">Aparecer input8</button><br>
<input type="text" placeholder="numero 8" name="" id="input8" style="display: none;"><br>
<button onclick="apa9()">Aparecer input9</button><br>
<input type="text" placeholder="numero 9" name="" id="input9" style="display: none;"><br>
</div>
<br>
<!--Este boton debera sumara el ultimo input de cada caja-->
<button>Sumar</button>
<input type="text" placeholder="resultado" name="">
</body>
</html>