the scenario is that i want to set the total price based on user choice of radio buttons, when user chooses one of the radio buttons the price changes accordingly.
here is the the HTML:
<div class="input_box">
<h4 style="text-align: center;">إختر الباقة</h4>
<input type="radio" name="package" class="radio" id="pk1" value="70">
<label for="pk1">بالساعة</label>
<input type="radio" name="package" class="radio" id="pk2" value="200">
<label for="pk2">يوم</label>
<input type="radio" name="package" class="radio" id="pk3" value="2500">
<label for="pk3">شهر</label>
</div>
<div class="input_box">
<input type="number" placeholder="Total Value" name="price" class="name" id="output">
<i class="fa fa-money icon" aria-hidden="true"></i>
</div>
i tried to use javaScript solution such as:
<script>
document.getElementsByName("package").addEventListener("change", function(){
document.getElementById("output").innerHTML = this.value;// Show the value in output element
});
</script>
but it seems nothing works for me, i appreciate any help, Thank you 🙂