Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Every time your <code>$("#addnew").click</code> event fires you will want to rebind the <code>keyup/calculateRow</code> method. Something like:</p> <pre><code>$('#addnew').click(function() { currentItem++; $('#items').val(currentItem); $('#data').append('&lt;tr&gt;\n\ &lt;td align="center"&gt;&lt;input type="text" size="6" maxlength="6" maxlength="6" name="ord_' + currentItem + '" class="form-input-oth" onkeyup="return copy(this.val());"/&gt;&lt;/td&gt;\n\ &lt;td align="center"&gt;&lt;input type="text" size="6" maxlength="6" maxlength="6" name="srno_' + currentItem + '" class="form-input-oth"/&gt;&lt;/td&gt;\n\ &lt;td align="center"&gt;&lt;textarea name="descrip_' + currentItem + '" cols="70" class="form-input-textareasm"&gt;&lt;/textarea&gt;&lt;/td&gt;\n\ &lt;td align="center"&gt;&lt;input type="text" size="6" maxlength="9" maxlength="6" name="unit_' + currentItem + '" class="form-input-rate"/&gt;&lt;/td&gt;\n\ &lt;td align="center"&gt;&lt;input type="text" size="6" maxlength="9" maxlength="6" name="prevqty_' + currentItem + '" class="prevqty form-input-rate" onkeyup="calculateRow();"//&gt;&lt;/td&gt;\n\ &lt;td align="center"&gt;&lt;input type="text" size="6" maxlength="9" maxlength="6" name="thisqty_' + currentItem + '" class="thisqty form-input-rate" onkeyup="calculateRow();"//&gt;&lt;/td&gt;\n\ &lt;td align="center"&gt;&lt;input type="text" size="6" maxlength="9" maxlength="6" name="qty_' + currentItem + '" class="qty form-input-rate" onkeyup="calculateRow();"/&gt;&lt;/td&gt;\n\ &lt;td align="center"&gt;&lt;input type="text" size="6" maxlength="9" maxlength="6" name="rate_' + currentItem + '" class="rate form-input-rate" onkeyup="calculateRow();"/&gt;&lt;/td&gt;\n\ &lt;td align="center"&gt;&lt;input type="text" size="6" maxlength="9" maxlength="6" name="amt_' + currentItem + '" class="cal form-input-amt" onkeyup="calculateRow();"/&gt;&lt;/td&gt;\n\ &lt;/tr&gt;' ); $('#data').off('keyup').on('keyup', '.prevqty, .thisqty, .qty, .rate, .cal', calculateRow); }); </code></pre> <p>Notice that <code>$("#data").off('keyup').on(...</code> at the end of the event? That should keep your new rows calculating correctly.</p> <p><strong>UPDATE</strong></p> <p>After reviewing the code you posted in your jsfiddle comment, I found a few HTML errors but I think the real problem was the way you were setting/calculating <code>qty</code>. Check out this update fiddle: <a href="http://jsfiddle.net/YS4N2/1/" rel="nofollow">http://jsfiddle.net/YS4N2/1/</a></p> <p>There you will see I set the qty input separate from how it is used for the purposes of calculation. This works ok.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload