Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save b1azk0/1ce28050a0df77999fe3b4feafae1a31 to your computer and use it in GitHub Desktop.
Save b1azk0/1ce28050a0df77999fe3b4feafae1a31 to your computer and use it in GitHub Desktop.
Qualtrics: Randomly reverse answer choices in multiple choice question. #qualtrics #js #jq #mc #random #reverse
Qualtrics.SurveyEngine.addOnload(function() {
var rand = Math.round(Math.random());
if(rand == 1) {
var choices = jQuery("#"+this.questionId+" li.Selection");
var lastChoice = choices.last();
for(i=0;i<choices.length-1;i++) {
lastChoice.after(choices[i]);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment