JSFiddle - React, Tailwind, and code Playground
HTML
<table class="IFTAtable" id="FuelTaxIFTA" width="100%" border="1" cellpadding="2.5" cellspacing="5">
<tr>
<th>Juristiction</th>
<th>Rate Code</th>
<th>Total IFTA Miles by State</th>
<th>Taxable Miles</th>
<th>MPG </th>
<th>Taxable Gallons</th>
<th>Tax Paid Gallons</th>
<th>Net Taxable Gallons</th>
<th>Tax Rate</th>
<th>Tax Credit or Tax Due</th>
<th>Interest </th>
<th>Total Due</th>
</tr>
<tr>
<td>CT</td>
<td>089</td>
<td>
<input type="text" class="CtMiles" /> </td>
<td>
<input type="text" name="stateMiles" id="CtMiles" class="CtMiles" />
</td>
<td>
<input id="MPG" type="text" name="mpg" class="mpg">
</td>
<td>
<input type="text" readonly="readonly" class="calcTax[State]" />
</td>
<td>
<input type="text" class="taxPdGallonsCT" onchange="doMath()" tabindex="1" placeholder="TCH RPT" />
</td>
<td></td>
<td>.4170</td>
<td></td>
<td> </td>
<td></td>
</tr>
<tr>
<td>DE</td>
<td>086</td>
<td>
<input type="text" class="DeMiles" readonly="readonly" />
</td>
<td>
<input type="text" name="stateMiles" id="DeMiles" class="DeMiles" readonly="readonly" />
</td>
<td>
<input id="MPG" type="text" name="mpg" class="mpg" readonly="readonly">
</td>
<td>
<input type="text" readonly="readonly" class="calcTax[State]" />
</td>
<td>
<input type="text" class="taxPdGallons[State]" tabindex="2" placeholder="TCH RPT" />
</td>
<td> </td>
<td>.2200</td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td>IN</td>
<td>179</td>
<td>
<input type="text" class="InMiles" readonly="readonly" />
</td>
<td>
<input type="text" name="stateMiles" id="InMiles" class="InMiles" readonly="readonly" />
</td>
<td>
<input id="MPG" type="text" name="mpg" class="mpg" readonly="readonly">
</td>
...
JavaScript
function calcCT() {
$(document).ready(function() {
var total = 0;
$(".CT").each(function() {
total += parseFloat($(this).text());
});
$("#CtMiles").val(Math.round(total));
doMath(CT);
});
}
function doMath(this) {
var miles = $(this).val();
var mpg = $(this).val();
var t = miles / mpg;
var tax = $(this).val(Math.round(t));
};