JSFiddle - React, Tailwind, and code Playground
by Mert Ener
HTML
<input class ="info" name="Hours" type="text" placeholder="Hours(NUMBERS ONLY!)" value="" id="lhrs" form="form1" /> <br>
<input class="info" name="Tax" type="number" placeholder="Tax" value="" id="ltax" form="form1"> <br>
<fieldset data-role="controlgroup">
<input type="radio" name="tax2" id="radio-choice-9" value="1" form="form1" />
<label for="radio-choice-9">Tax Exempt</label>
<input type="radio" name="tax2" id="radio-choice-8" value="0.075" form="form1" />
<label for="radio-choice-8">NJ 7%</label>
<input type="radio" name="tax2" id="radio-choice-7" value="8.25" form="form1" />
<label for="radio-choice-7">NYC 8.875</label>
</fieldset>
<fieldset data-role="controlgroup">
<input type="radio" name="radio-choice" id="radio-choice-1" value="185.00" form="form1" />
<label for="radio-choice-1">Networking: $185.00</label>
<input type="radio" name="radio-choice" id="radio-choice-2" value="125.00" form="form1" />
<label for="radio-choice-2">Mechanical: $125.00</label>
<input type="radio" name="radio-choice" id="radio-choice-3" value="59.00" form="form1" />
<label for="radio-choice-3">Remote First 1/2 hour: $59.00</label>
<input type="radio" name="radio-choice" id="radio-choice-4" value="89.00" form="form1"/>
<label for="radio-choice-4">Remote 1 Hour: $89.00</label>
</fieldset>
<br>
<label for="SubTotal" style="display:none" >Sub Total</label><br>
<input name="SubTotal" type="number" placeholder="SubTotal" value="" id="lstot" form="form1" > <br>
<label for="Total" style="display:none" >Total</label><br>
<input name="Total" type="number" placeholder="Total" value="" id="lltot" form="form1"> <br>
JavaScript
$( 'input[name=radio-choice]' ).on( 'click' , function() {
if ($.isNumeric($(".info").val())) {
$( "#lstot" ).val($( "#lhrs").val()*$( 'input[name=radio-choice]:checked' ).val()),
$("#lltot").val((($("#lstot").val()*$("#ltax").val()) * 100) / 100).trigger("change");
} else {
alert("Please enter valid info");
}
});