The alert you see after the while loop keeps saying NaN for the price variable. Idk what's wrong with my code but I know it has to do with the value attributes/parsing ints. Everything else works fine Can anyone spot it? Thank you!
var c = 0;
while (checkedBoxes[c] != null) {
price += parseFloat(checkedBoxes[c].value);
c++;
}
alert("You picked " + c + " ingredients. That will cost you " + price + " dollars.");
Here is the html I have that i refers to:
<li name="meatItem" id="m1">
<input type="checkbox" name="checkItem" id="Pep" value="1.5">Pepperoni
</li>
<li name="meatItem" id="m2">
<input type="checkbox" name="checkItem" id="CB" value="1.5">Canadian Bacon
</li>