JSFiddle - React, Tailwind, and code Playground
by vivek devaiah
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>
<span class='amount'></span>
JavaScript
$('#payment-form input').on('change', function () {
if ($("input[name='Product']:checked").val() == 'Lifetime') {
var price = "£30";
} else if ($("input[name='Product']:checked").val() == 'Pro Monthly') {
var price = "£3 a month";
}
$("span.amount").html(price);
});