Live calculation on jquery change
<p>We are using following fields to do some calculation.</p>

<pre><code>$(document).ready(function(){
$('.num').blur(function () {
var amount    = parseInt($('#amount').val()) || 0;
var openbal = parseInt($('#openbal').val());
var disc    = parseInt($('#disc').val());
var netpay  = fees+openbal-disc || 0;
$('#netpay').val(netpay);
});
});
</code></pre>

<p>And here is html code</p>

<pre><code> &lt;select name="product" class="product"&gt;
   &lt;option selected&gt;Select product&lt;/option&gt;
   &lt;option&gt;Product1&lt;/option&gt;
   &lt;option&gt;Product2&lt;/option&gt;
 &lt;/select&gt;
&lt;input type="text" size="30" name="amount" class="num" id="amount" /&gt;
&lt;input type="text" class="num" name="openbal" value="0" id="openbal" /&gt;
&lt;input type="text" class="num" name="disc" value="0" id="disc" /&gt;
&lt;input type="text" name="netpay" id="netpay" /&gt;
</code></pre>

<p>So What we are doing here is...</p>

<ol>
<li>Select product from drop down list and fetch amount(#amount) using ajax.</li>
<li>We are doing calculation using <code>.num(class)</code> like given discount or any pending balance.</li>
</ol>

<p>Our code is working fine, but it only updates netpay(#netpay) when we blur on any .num field and it updates calculation. But we would like to do calculation after amount receives its value and even should update netpay(#netpay) if we updates any of num(.num) field, for example we give discount(#disc) 500, so netpay(#netpay) should be updated.</p>

<p>thanks for your support.</p>
