Get input ids using for no js

0
Hello, I'm trying to get the value of 10 inputs and put them in a vector of 10 houses, but I'm not able to do this by, can anyone help me get it to be% var from% by example get the value of n[0] ?

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: link

    
asked by anonymous 24.05.2018 / 20:31

1 answer

1

You are trying to get innerHTML of inputs when you should get value :

n[i] = document.getElementById(inputId).value;
    
24.05.2018 / 20:38