Based on what posted here. Look like the below codes are missing a "}" and the selectedCrust variable should be outside the loop
for (var i = 0; i < crustArray.length; i++) {
if (crustArray[i].checked) {
if (crustArray[i].checked) {
var selectedCrust = crustArray[i].value;
}
}
The code should look like:
var selectedCrust;
var crustArray = document.getElementsByClassName("Crust");
for (var i = 0; i < crustArray.length; i++) {
if (crustArray[i].checked) {
if (crustArray[i].checked) {
selectedCrust = crustArray[i].value;
}
}
}
Example:
cp_pizza - JSFiddle[
^]
There also tags issue with the HTML markup. Example, </input> is not a valid closing tag.