I have checked the following question : How to output the price when clicking the radio button?
But it didn't help me with solution, that's why I am posting similar question.
I have two radio check boxes. One offers Silver plan and the other Gold plan. If the user clicks Silver Plan that the Total price will be $499.
I don't understand how to best achieve it.
<div class="plan-wrapper">
<label id="silver-plan"><input class="btn-checkbox" type="radio" name="groupnine" onclick="calculate(this);" value="$699"/> Silver Plan</label>
<label id="silver-plan-price">$699</label>
<label id="gold-plan"><input class="btn-checkbox" type="radio" name="groupnine" onclick="calculate(this);" value="$999"/> Gold Plan</label>
<label id="gold-plan-price">$999</label>
</div>
<div class="wrapper-b">
<span id="total">Total</span>
<output type="number" name="price" id="output"></output>
<!--<span id="total-price"></span>-->
</div>
JS
<script>
function calculate(obj) {
document.getElementById("output").innerHTML = obj.value;
}
</script>