Skip to content

Instantly share code, notes, and snippets.

@catherinemaldonado
Last active December 18, 2015 17:01
Show Gist options
  • Save catherinemaldonado/7bae562e43da5a82d340 to your computer and use it in GitHub Desktop.
Save catherinemaldonado/7bae562e43da5a82d340 to your computer and use it in GitHub Desktop.
if (personality === true){
// TALLY SUBMITTED ANSWERS FOR EACH CHARACTER FOR PERSONALITY QUIZ
$("input:radio").each( function() {
if($(this).prop("checked") === true) {
val = $(this).attr("class");
// INCREASE PERSONALITYCOUNT FOR SELECTIONS
for (var i = 0; i < personalityOptions.length; i++) {
if (personalityOptions[i] === val){
var match = personalityCount.map(function(e) { return e.character; }).indexOf(val);
personalityCount[match].count = personalityCount[match].count + 1;
}
}
}
});
} else {
// CAPTURE SUBMITTED ANSWERS FOR TRIVIA QUIZ
$("input:radio").each( function() {
if ($(this).prop("checked") === true) {
var text = $(this).next("span").text();
submittedAnswers.push(text);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment