Jquery: calculate value on blur event
<p>I am trying to do some live calculation on my form, please have a look at form...</p>

<pre><code>&lt;input type="text" value="0" name="product1" class="num"/&gt;
&lt;input type="text" value="0" name="product2" class="num" /&gt;
&lt;input type="text" value="0" name="product3" class="num"/&gt;
&lt;input type="text" value="0" name="cost" class="cost"/&gt;
</code></pre>

<p>And jquery code...</p>

<pre><code>$(function() {
var cost = 0;
$('.num').blur(function(){
cost+= parseFloat($(this).val());
});
$('.cost').val(cost);
});
</code></pre>

<p>But its not working, please help thanks.</p>
