Created
February 23, 2012 13:54
-
-
Save andreacampi/1892971 to your computer and use it in GitHub Desktop.
How to get the best score on an Oatmeal quiz
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
# navigate to the quiz with your favorite browser; | |
# open up a JavaScript console (e.g. Inspector if you use Safari / Chrome; Firebug if you use Firefox); | |
# paste the JavaScript snippet that you find below |
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
$('#questions .question').each(function() { var max=-1,best; console.info(parseInt($('.question_number', this).text())+'. '+$('h3', this).text()); $('li', this).each(function() { var v=$('input[type=radio]', this).attr('value'); if (v > max) { max = v; best = this; } }); console.info($('label', best).text()); }); null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
awesome.