below I have written my script code and html portion for a section of my code that I feel may contain an error that my eyes are not catching. In this code, there is supposed to be a discount section, if a user clicks ‘yes’ instead of ‘no’, a 10% discount is applied, the ‘no’ part runs fine, but the ‘yes’ part doesn’t. I have already checked for syntax and grammatical errors but feel that I may be skimming over them, or my code might be missing an important piece. I have put my code down below, both the script and html portions. If anyone has any insight or spots something, please let me know! Thanks!
var membersDiscount;
membersDiscount = document.getElementById("radFirstChoice").value;
if (radFirstChoice == "Yes") {
membersDiscount = (results * .10);
}
else {
membersDiscount = 0;
}
var truePrice;
truePrice = results - membersDiscount;
truePrice = parseFloat(truePrice);
truePrice = truePrice.toFixed(2);
<p><label>Are you a member of our frequent shipper club?</label></p>
<p><label for="radFirstChoice">Yes</label>
<input type="radio" id="radFirstChoice" name="userInformation"></p>
<p><label for="radSecondChoice">No</label>
<input type="radio" id="radSecondChoice" name="userInformation"></p>