Created
March 17, 2015 20:10
-
-
Save kazzkiq/2ebeedc99e8dd383a46c 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
function resultsFromForm(el){ | |
var results = {}; | |
$('.question',el).each(function(){ | |
var iv = $('input:checked', this)[0].value; | |
if(iv.split("|").length > 1){ | |
var iarray = iv.split("|"), isize = iarray.length, i; | |
console.log(iarray); | |
for(i = 0; i < isize; i++){ | |
if(results[iarray[i]] == undefined){ | |
results[iarray[i]] = 1; | |
}else{ | |
results[iarray[i]]++; | |
} | |
} | |
}else{ | |
if(results[iv] == undefined){ | |
results[iv] = 1; | |
}else{ | |
results[iv]++; | |
} | |
} | |
}); | |
console.log(results); | |
return results; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment