JSFiddle - React, Tailwind, and code Playground

by mudBorn

HTML

<body style="height: 100%;">
	
		<form id="monthRevenue" action="../macro/$proj/cgi/DB_monthRevenue.cgi" method="post" enctype="multipart/form-data">
		<input type="radio"  value="excise" name="excOrSer" id="excise" />excise duty
		<input type="radio" value="service" name="excOrSer" id="service" />service tax
		
		<div id="returns" style="height: 90%;width: 100%;overflow: auto">
            	</div>
	    </form>
	
	</body>

JavaScript

$(document).ready(function(){
 alert('document is loaded');
        //iterate through each textboxes and add keyup
        //handler to trigger sum event
  $("input[name*='bed'][class='column']").each(function() {
alert('in the bed'); //doesn't go into this
            $(this).keyup(function(){
			
                calculateSum();
            });
        });
 
    });
 
    function calculateSum() {
 
        var sum = 0;
        //iterate through each textboxes and add the values
        $("input[name*='bed'][class='column']").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
        $("input[name='totalBEDamount']").val(sum.toFixed(2));
    }









// below code is for table creation
var exciseInputFields = {			
					   	'Cenvat Register A BED - 120040' 			: '120040bed',
						'Service tax BED - 120310'		 			: '120310bed',
						'Cenvat Register C BED - 120150' 			: '120150bed',
						'Cenvat Register A ADC - BED - 120064'      : '120064bed',
						'Cenvat Register C ADC -BED - 120144'		: '120144bed',
						'PLA BED  -         120000'					: '120000bed',
						'TOTAL - BED'								: 'totalBED',
						'PLA NCCD   -    120006'					: 120006,
						'CENVAT  NCCD - 120070'						: 120070,
						'TOTAL - NCCD'								: 'totalNCCD',
						'PLA EDN CESS -              120243'		: 120243,
						'Cenvat Register A EDN Cess - 120244'		: 120244,
						'Cenvat Register C EDN Cess - 120245'		: 120245,
						'Service tax EDN Cess -  120311    '		: 120311,
						'EDN CESS TOTAL'							: 'totalEDNe',
						'PLA S & H EDN CESS -           120496'		: 120496,
						'Cenvat Register A S & H EDN Cess -120493'  : 120493,
						'Cenvat Register C S & H EDN Cess - 120494' : 120494,
						'Service tax S & H EDN Cess - 120495'		: 120495,
						'S & H EDN CESS...