Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
/** https://github.com/mikestratton/jquery-quiz **/
for(var i = 1; i <= 45; i++) { // loop radio buttons
var radios = document.getElementsByName('q'+i); //used to increment questions in html
for(var j = 0; j < radios.length; j++) {
var radio = radios[j];
if(radio.value == "1" && radio.checked) {
amountCorrect = amountCorrect + 1; //add radio value to total
}
}
}
if(amountCorrect <= 30) {
document.getElementById("total").innerHTML = "Your Score: " + amountCorrect;
document.getElementById("results").innerHTML = "<strong>Your message here</strong>"; //send to html
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment