form validation on appended boxes
<p>I am using following form fields</p>

<pre><code>&lt;li&gt;&lt;input type="text" name="name" /&gt;&lt;/li&gt;
&lt;li&gt;&lt;input type="text" name="city" /&gt;&lt;li&gt;
&lt;li&gt;&lt;input type="text" name="fees" class="num" id="fees" /&gt;&lt;li&gt;
&lt;li&gt;&lt;input type="text" name="openbal" class="num" id="openbal" /&gt;&lt;li&gt;
&lt;li&gt;&lt;input type="text" name="discount" class="num" id="disc" /&gt;&lt;li&gt;
&lt;li&gt;&lt;input type="text" name="netpay" id="netpay" /&gt;&lt;li&gt;
&lt;li&gt;  &lt;ul id="fields"&gt;&lt;/ul&gt;  &lt;/li&gt;
&lt;button type="submit" name="submit" id="upload"&gt;&lt;span&gt;submit&lt;/span&gt;&lt;/button&gt;
</code></pre>

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

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

$(document).ready(function() {
$('#instal').bind('textchange', function (event, previousText) {
    var instalval = parseInt($(this).val());
    if($('#fields').children().hasClass('inputs')) {
    $('.inputs').remove();
    }
    if(instalval != '') {
    for( i = 0; i &lt; instalval; i++) {
        $('#fields').append('&lt;li class="inputs clearfix"&gt;&lt;input type="text" class="small date" size="30" name="payment[date][]" placeholder="Date" /&gt; &lt;input type="text" class="xsmall rfee" size="30" name="payment[regfee][]" placeholder="Reg. Fee" /&gt; &lt;input type="text" class="xsmall tfee" size="30" name="payment[tutfee][]" placeholder="Tut. Fee" /&gt; &lt;input type="text" class="small totalfee" size="30" name="payment[total][]" placeholder="Total" /&gt; &lt;span title="Remove this" class="ui-icon ui-icon-closethick closefield"&gt;&lt;/span&gt; &lt;/li&gt;');
$(".rfee,.tfee").keyup(function() {
var $li = $(this).closest("li");
var rfee = parseFloat($li.find(".rfee").val());
var tfee = parseFloat($li.find(".tfee").val());
if(isNaN(rfee)) rfee = 0;
if(isNaN(tfee)) tfee = 0;
$li.find(".totalfee").val(rfee + tfee);
});
    }
    }  
});
$('.closefield').live('click', function() {
$(this).parent().remove();
});
});

$(function() {
$("#addstudent").submit(function() {
if ($("#upload span").text() == "submit") {
    alert("Please confirm if everything is correct");
    $("#upload span").text("confirm");
    // Top of the PAGE
    $(document).scrollTop(0);
    // Top of the FORM
    /* $(document).scrollTop( $("#uguu").offset().top ); */  
    return false;
}
});
});
</code></pre>

<p>Now i am trying to achieve following validation...</p>

<pre><code>#netpay must be equal to appended sum of .totalfee
</code></pre>

<p>I mean installment plan should not be greater than net payable value.</p>

<p>hope you got the idea, i want help with the code to achieve it. thanks. </p>
