0
Hello, I’m trying to take the value of 10 inputs and put them in a vector of 10 houses, but I’m not able to do it for the sake of, can someone help me to get no off var n[0]
for example take the value of inputVetor0
?
var i;
function calcularMaior() {
var n = new Array(10);
for(i = 0; i < 10; i++) {
var input = "input";
var inputNumero = "" + i.toString();
var inputId = input.concat(inputNumero);
n[i] = document.getElementById(inputId).innerHTML;
}
alert("Array 0 = " + n[0];
}
Complete code: https://jsfiddle.net/sf14tf8c/
thanks bro, I’m very new still, I had based on a similar problem and adapted, so I didn’t understand what was to do, really worth.
– Paulo Henrique Rodrigues Grund
Tip:
innerHTML
is what stands between<tag>
and</tag>
. Notice that inputs have no closing tag. With inputs and selects you should always usevalue
to obtain the current value.– bfavaretto