Cannot sum more than 9 input javascript
<p>i have a small issue in my script and i cannot get the sum for more than 9 input's.</p>

<p>Up to 9 is working good, but if you add a new input field this stop working.</p>

<p>Div whit input and buttons:</p>

<pre><code>&lt;div id="valuesContainer"&gt;
&lt;input type="text" id="value01" /&gt;
&lt;input type="text" id="value02" /&gt;
&lt;input type="text" id="value03" /&gt;
&lt;input type="text" id="value04" /&gt;
&lt;input type="text" id="value05" /&gt;
&lt;input type="text" id="value06" /&gt;
&lt;input type="text" id="value07" /&gt;
&lt;input type="text" id="value08" /&gt;
&lt;input type="text" id="value09" /&gt;

&lt;/div&gt;
&lt;input type="button" value="Add Value" id="addMore" onclick="addInput();" /&gt;
&lt;input type="button" value="Calculate Total" onclick="getTotal();" /&gt;
&lt;div id="total"&gt;&lt;/div&gt;
</code></pre>

<p>Javascript doing the sum with function to add new input fields.</p>

<pre><code>    &lt;script type="text/javascript"&gt;
var max = 9;

function getValues(id){
    var result = document.getElementById(id).value;
    return (result ? result : 0);
}

function addInput(){
    max++;
    var input = '&lt;input type="text" id="value'+ max +'" /&gt;';
    document.getElementById("valuesContainer").innerHTML += input;
}

function getTotal(){
    var sum = 0;
    for(var i=1; i &lt;= max; i++){
        sum = sum + parseFloat(getValues("value0" + i));
    }
    document.getElementById("total").innerHTML = sum;
}
    &lt;/script&gt;
</code></pre>
