jQuery(document).ready(function(){
 
        jQuery(".txt").each(function() {
 
            jQuery(this).keyup(function(){
                calculateSum();
            });
        });
		
		jQuery(".txt1").each(function() {
 
            jQuery(this).keyup(function(){
                calculateSum1();
            });
        });
 
    });
 
    function calculateSum() {
 
        var sum = 0;
        //iterate through each textboxes and add the values
        jQuery(".txt").each(function() {
 
            //add only if the value is number
            if(!isNaN(this.value) && this.value.length!=0) {
                sum += parseFloat(this.value);
            }
 
        });
        //.toFixed() method will roundoff the final sum to 2 decimal places
        jQuery("#sum").html(sum.toFixed(2));
    }
	
    function calculateSum1() {
 
        var sum = 0;
        //iterate through each textboxes and add the values
        jQuery(".txt1").each(function() {
 
            //add only if the value is number
            if(!isNaN(this.value) && this.value.length!=0) {
                sum += parseFloat(this.value);
            }
 
        });
        //.toFixed() method will roundoff the final sum to 2 decimal places
        jQuery("#sum1").html(sum.toFixed(2));
    }
