Skip to content

Instantly share code, notes, and snippets.

@yangshun
Last active April 6, 2018 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yangshun/95821bcfd4b4777e90b5 to your computer and use it in GitHub Desktop.
Save yangshun/95821bcfd4b4777e90b5 to your computer and use it in GitHub Desktop.
For sharing your Coursera quiz answers with your friends
// Steps to share Coursera Quiz answers
// =====
// 1. Open the web developer console. In Chrome, press ctrl/cmd + shift + J, in Firefox, press ctrl/cmd + shift + K
// 2. Copy the following code below and paste it in the console. Press enter.
// 3. Your answers will be printed out and you can share it with other people (:
//
(function () {
var answer = '\n';
$('.course-quiz-question-body').each(function (index) {
var $this = $(this);
answer += 'Q' + (index + 1) + '. ' + $this.children('.course-quiz-question-text').text() + '\n';
var $inputs = $this.find('.course-quiz-input');
var $choices = $inputs.filter(function () {
return $(this).prop('checked');
});
var choicesText = [];
if ($choices.length > 0) {
var $choicesText = $.each($choices, function () {
choicesText.push(' - ' + $.trim($(this).siblings('label').text()));
});
choicesText.sort();
} else {
choicesText.push(' No choices selected');
}
answer += choicesText.join('\n') + '\n\n';
});
console.log(answer);
})();
Copy link

ghost commented Apr 6, 2018

This doesn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment