JSFiddle - React, Tailwind, and code Playground

by Vengatesh rkv

HTML

<form id="payment-form">
<label class='control-label'>Plan</label><br>
    <input type='radio' name='Product' value='Pro Monthly' checked/> Monthly
    <input type='radio' name='Product' value='Lifetime'/> Lifetime
</form>
    
Total: <span class='amount'></span>

JavaScript

$('#payment-form input').on('change', function () {
var plan = $('input[name=Product]:checked', '#payment-form').val();

if (plan == "Lifetime") {
    var price = "&pound;30";
    
} else if (plan == "Pro Monthly") {
    var price = "&pound;3 a month";
}
$("span.amount").html(price);
});