So I have a javascript to add together values entered, that works just fine. I need to add the value of the selected radio button to this equation. I was adding by Id value, so I imagine sticking to that would be great. I cannot figure this out...I've searched but everywhere just indicates how to validate the selection.
I don't think this is duplicated...I need the value of the selected radio button and the value has to be added to the equation.
Radio Options
<input type="radio" name="int" id="0" value="none">None
<input type="radio" name="int" id="10" value="Ten">10
<input type="radio" name="int" id="20" value="Twenty">20
<input type="radio" name="int" id="30" value="Thirty">30
This is what my javascript looks like:
function calculate()
{
var userInput = document.getElementById("pkg").value*1;
var userInput2 = document.getElementById("pep").value*1;
var addBox = document.getElementById("addtl").value*1;
var totalNum = document.getElementById("add_cost").value*1;
// Sum everything
var SumAll = userInput + userInput2 + (addBox*totalNum);
// print the total
document.getElementById("Sum").innerHTML = SumAll.toFixed(2)
}