multiplying dynamically generated selectbox and textbox values and displaying the result in another textbox in jquery
<p>In the below fiddle I have written the code to multiply textbox(qty,price) and selectbox(Tax%) values and fill the Total textbox value with the result of caluculate(javascript function).</p>

<p>Please see the fiddle <a href="http://jsfiddle.net/fvJgE/13/" rel="nofollow">http://jsfiddle.net/fvJgE/13/</a> for the code.Can anybody spot What I'm missing or where I'm doing wrong?</p>

<p>Jquery Code</p>

<pre><code>var count = 1;
        $(document).ready(function () {

            $("#addButton").click(function () {

            if(count&gt;7){
                alert("Only 7 textboxes allow");
                return false;
                }   

        var newTextBoxDiv = $(document.createElement('div'))
        .attr("id", 'TextBoxDiv' + count);

        newTextBoxDiv.after().html(
          '&lt;label&gt;Desc #'+ count + ' : &lt;/label&gt;' +
      '&lt;input type="text" size="4" name="desc[]" id="desc' + count + '" value="" &gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;\n\
          &lt;label&gt;Tax #'+ count + ' : &lt;/label&gt;' +
      '&lt;select id="tax_type' + count + '" &gt;&lt;option value="tax1"&gt;VAT&lt;/option&gt;&lt;option value="tax2"&gt;ST&lt;/option&gt;&lt;/select&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;\n\
          &lt;label&gt;Tax% #'+ count + ' : &lt;/label&gt;' +
          '&lt;select id="tax_per' + count + '" &gt;&lt;option value="Vat"&gt;5.5&lt;/option&gt;&lt;option value="ST"&gt;14.5&lt;/option&gt;&lt;/select&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;\n\
          &lt;label&gt;Qty #'+ count + ' : &lt;/label&gt;' +
      '&lt;input type="text" size="1" name="qty[]" id="qty' + count + '" value="" &gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;\n\
          &lt;label&gt;price #'+ count + ' : &lt;/label&gt;' +
      '&lt;input type="text" size="2" name="price[]" id="price' + count + '" value="" &gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;\n\
      &lt;label&gt;Total #'+ count + ' : &lt;/label&gt;' +
          '&lt;input type="text" size="3" name="total[]" id="total' + count + '" value="" &gt;'
    );

          newTextBoxDiv.appendTo("#TextBoxesGroup");
            $('#qty' + count).on("blur", function() {
            calculate($(this));
           });
            $('#price' + count).on("blur", function() {
            calculate($(this)); 
            });
            $('#tax_per' + count).on("change", function() {
            calculate($(this)); 
            });

           count++;  

        });//closing the addButton function     

        //To caluculate Total amount based on price and tax percentage   
         function calculate(el) {
        var count = el.attr("id").indexOf("qty") != -1 ?               el.attr("id").substring(3) : el.attr("id").substring(5);
        var qty = isNaN(parseFloat($('#qty' + count).val())) ? 0 :      parseFloat($('#qty' + count).val());
        var price = isNaN(parseFloat($('#price' + count).val())) ? 0 :     parseFloat($('#price' + count).val());
        var tax_per = isNaN(parseFloat($('#tax_per' + count).val())) ? 0 :            parseFloat($('#tax_per' + count).val());
        var value = qty*price;
        //alert(value);
        var tax_amt = (value*tax_per)/100;
        //alert(tax_amt);
        var total_value = value + tax_amt;
        $("#total" + count).val(total_value);
        }


          //To remove the added textboxes
          $("#removeButton").click(function () {
                if(count==0){
                alert("No more textbox to remove");
                return false;
                }
                count--;

                $("#TextBoxDiv" + count).remove();
                });

         });
</code></pre>

<p>HTML Code</p>

<pre><code>&lt;table&gt;
&lt;tr&gt;
 &lt;td&gt;
    &lt;input type="button" id="addButton" value="Add" class="add" &gt;
    &lt;input type="button" id="removeButton" value="Delete" class="remove" &gt;
 &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
 &lt;table&gt;
  &lt;tr&gt;
    &lt;td&gt;
       &lt;div id='TextBoxesGroup'&gt;

        &lt;/div&gt;
     &lt;/td&gt;
 &lt;/tr&gt;
&lt;/table&gt;
</code></pre>

<p>The value gets displayed in the Total textbox but its not considering the selectbox(Tax%) value in caluculation. Thanks in advance for the help. </p>
