Last active
April 13, 2017 03:17
-
-
Save mikestratton/610ec41b616e4f6a4b9a4e2b2e1be05d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** 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