var q1textbox = document.getElementsByClassName('q1');
var q2radio = document.getElementsByClassName('q2');
var correct = 0;
var wrong = 0;
var total = 10;
var grade = 0;
function doTheCorrecting() {
// Question one
if (q1textbox.value == 'Scott') {
correct+= 1;
console.log('q1 was correct ' + 'correct=' + correct);
} else {
wrong+= 1;
console.log('q1 is wrong ' + 'wrong=' + wrong);
}
// Question two
if (q2radio.checked = true) {
correct+= 1;
console.log('q2 was correct ' + 'correct=' + correct);
}
if (q2radio.checked = false) {
wrong += 1;
console.log('q2 is wrong ' + 'wrong=' + wrong);
}
// Question three
// Question four
// Question five
grade = total - wrong;
console.log('grade is ' + grade)
}
I've been trying to figure out how to grade a quiz I made and I've spent around a hour trying to figure out how to do it. The main error is that even when I type Scott into the textbox, it still adds 1 to wrong. How can I fix this?