get data from dynamic form into javascript and returning it callculated
<p>i have form that dynamically add data..   the data is about products name, how much product and prices with or without taxes.. </p>

<p>the form adds inputes :</p>

<p>this is originally form: (after the dynamically generation:</p>

<pre><code>&lt;div class="row"&gt;
        &lt;input type="hidden" name="count" value="1" /&gt;
&lt;div class="input_fields_wrap" class="float-left" dir="rtl" align="right" width="900px"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
    &lt;button class="add_field_button"&gt;הוסף עוד שורה&lt;/button&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/br&gt;
    &lt;div align="center"&gt; שם המוצר&amp;nbsp; :&lt;input type="text" id="item_name[]" name="item_name[]" /&gt;
    &amp;nbsp;כמות המוצר :&lt;input type="number" id="how_much[]"   name="how_much[]" style=" font-size: 12px; line-height: 1.2em; width: 95px;"  /&gt;
    &amp;nbsp;עלות המוצר&amp;nbsp; :&lt;input type="number" id="item_price0]" name="item_price[]" onchange="update1(0);" style=" font-size: 12px; line-height: 1.2em; width: 95px;" /&gt;
    עלות אחרי מע&amp;quot;מ&amp;nbsp; :&lt;input type="number"  id="item_price_tax[]" name="item_price_tax[0]" onchange="update2(0);" style=" font-size: 12px; line-height: 1.2em; width: 95px;" /&gt;
    סכום&amp;nbsp; :&lt;input type="number"  id="item_price_total[]" name="item_price_total[]" onchange="update1(0);"  style=" font-size: 12px; line-height: 1.2em; width: 125px;"/&gt;
&amp;nbsp;&amp;nbsp;   &amp;nbsp;   &amp;nbsp;
   &lt;/div&gt;
</code></pre>

<p>here is the dynamical outo generation :</p>

<pre><code>&lt;SCRIPT&gt;
$(document).ready(function() {
    var max_fields      = 99999; //maximum input boxes allowed
    var wrapper         = $(".input_fields_wrap"); //Fields wrapper
    var add_button      = $(".add_field_button"); //Add button ID

    var x = 0; //initlal text box count
    $(add_button).click(function(e){ //on add input button click
        e.preventDefault();
        if(x &lt; max_fields){ //max input box allowed
            x++; //text box increment
                   $(wrapper).append('&lt;div class="product-item float-clear" style="clear:both;"  align="center"&gt;שם המוצר&amp;nbsp; :&lt;input type="text" id="item_name['+x+']" name="item_name['+x+']" /&gt;&amp;nbsp;כמות המוצר :&lt;input type="number" id="how_much['+x+']" name="how_much['+x+']"  style=" font-size: 12px; line-height: 1.2em; width: 95px;"  onchange="update1('+x+');"  /&gt;&amp;nbsp;עלות המוצר&amp;nbsp; :&lt;input type="number" id="item_price['+x+']"  style=" font-size: 12px; line-height: 1.2em; width: 95px;" name="item_price['+x+']" onchange="update1('+x+');"  /&gt; עלות אחרי מע&amp;quot;מ&amp;nbsp; :&lt;input type="number"  id="item_price_tax['+x+']" style=" font-size: 12px; line-height: 1.2em; width: 95px;" name="item_price_tax['+x+']" onchange="update1('+x+');" /&gt;סכום&amp;nbsp; :&lt;input type="number" style=" font-size: 12px; line-height: 1.2em; width: 125px;"  id="item_price_total['+x+']" name="item_price_total['+x+']" onchange="update1('+x+');" /&gt;&lt;a href="#" class="remove_field"&gt;הסר&lt;/a&gt;&lt;/div&gt;'); //add input box
          }
    });

    $(wrapper).on("click",".remove_field", function(e){ //user click on remove text
        e.preventDefault(); $(this).parent('div').remove(); x--;
    })
});

&lt;/SCRIPT&gt;
</code></pre>

<p>now i want to make script that fill in the last input boxes (i already wrote onchange="updat1();"  but the function isn"t working and i dont know how to pass and hw to return correctly here it is ! :</p>

<pre><code>function update1(x)
{


        var how_much = "#how_much[]";

        var item_price = "#item_price[]";

        var item_price_tax = "#item_price_tax[]";
        var item_price_tax3 = "item_price_tax[]";

        var item_price_total = "#item_price_total[]";
          var item_price_total3 = "item_price_total[]";


      var how_much2 =     document.getElementById("how_much[]").value;
           var item_price2 =   document.getElementById("item_price[]").value;
           var item_price_tax2 =  document.getElementById("item_price_tax[]").value;
         var item_price_total2 =  document.getElementById("item_price_total[]").value;


if((item_price_tax2==0)||(item_price_tax2=='')){

alert(2);

item_price_tax3.value = document.getElementById(item_price2).value * 1.17;
item_price_total3.value=document.getElementById(item_price2).value * 1.17 * how_much2;
item_price_tax[].value=document.getElementById(item_price2).value * 1.17 * how_much2;
item_price_total[].value=document.getElementById(item_price2).value * 1.17 * how_much2;
}

else{
item_price.value3 = document.getElementById(item_price).value * 83%;
item_price_total3.value=document.getElementById(item_price).value  * 83% * how_much;
}
}

&lt;/SCRIPT&gt;
</code></pre>

<p>help needed thanks alot</p>