JSFiddle - React, Tailwind, and code Playground

by calder12

HTML

<form action="">
  <input class="radio-btn" type="radio" name="price" value="25"> Dinner 1<br>
  <input class="radio-btn" type="radio" name="price" value="15"> Dinner 2<br>
  <input class="radio-btn" type="radio" name="price" value="10"> Dinner 3<br>
  <input id="registration-fee" name="RegistrationFee" type="text" value="50" readonly/>
  <input id="thursday-dinner-fee" name="ThursdayDinnerFee" type="text" readonly/>
  <input id="amount-due" name="AmountDue" type="text" readonly  />
</form>

JavaScript

$(".radio-btn").on("click", function(){
	var $value = $(this).val();
  var $registration = $("#registration-fee").val();
	$("#thursday-dinner-fee").val($value);
  var total = parseInt($value) + parseInt($registration);
  $("#amount-due").val(total);
})