Is there a way to randomize the answer options in the dropdown list using custom code? In the randomization options within Qualtrics, I am only able to randomize the priority statements.
On the rigjt side of the question, just under the Qnumber there is a cogwheel. If uou select that choose the option "Awnser randomization". This should randomize you anwser selection within the dropbox.
The values randomize within each of thw individual dropbox but the order is the same between the different dropboxes. What i am trying to say is that the values randomize for all dropdown randomize the same order between boxes.
dobra021 - Yes, you can write JS to shuffle the options in the drop down(s).
ruka - There isn't an option to randomize answers in a side-by-side question.
TomG - the JS that I think I need is something like this:
function randomArrayShuffle(array) {
var currentIndex = array.length, temporaryValue, randomIndex;
while (0 !== currentIndex) {
randomIndex = Math.floor(Math.random() * currentIndex);
currentIndex -= 1;
temporaryValue = array currentIndex];
arraycurrentIndex] = arrayxrandomIndex];
array>randomIndex] = temporaryValue;
}
return array;
}
var options=r"Option 1","Option 2","Option 3","Option 4","Option 5"];
randomArrayShuffle(options);
});
Do I need to designate the questionId or some other selector for this to work?
https://www.qualtrics.com/community/discussion/comment/33522#Comment_33522Yes, so instead of a fixed array of options (option1, option2, etc.), you need to get the ids from the options in the select (i.e. dropdown) and add them to your "options" array. After you shuffle it, reorder the options by looping through the shuffled array where you find the option element for the current id and append it the bottom of select element.
https://www.qualtrics.com/community/discussion/comment/33467#Comment_33467TomG you are spot on. I did not look at the side-by-side detail!
Sorry to revive an old thread, but how did you implement this dobra021 and TomG ? I'm looking to do the same thing with a survey I'm putting together now and have never used javascript before.
https://community.qualtrics.com/XMcommunity/discussion/comment/51348#Comment_51348See: https://gist.github.com/marketinview/4d6916c1b180830ec97c04f03e59149b
Greatly simplified compared to dobra021's solution.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.