JSFiddle - React, Tailwind, and code Playground
HTML
<form name="myForm">
<input type="radio" name="myRadios" value="3" >3%</value>
<input type="radio" name="myRadios" value="5" >5%</value>
<input type="radio" name="myRadios" value="7" >7%</value>
</form>
Amount: <span id="amount"></span>
<script>
var amountField = document.getElementById('amount');
var rad = document.myForm.myRadios;
var prev = null;
for(var i = 0; i < rad.length; i++) {
rad[i].onclick = function() {
console.log(this.value);
if(this !== prev) {
prev = this;
amountField.textContent = 1000+1000*this.value/100;
}
};
}
</script>