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.
Side by side: Randomize dropdown options
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.
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];
array[currentIndex] = array[randomIndex];
array[randomIndex] = temporaryValue;
}
return array;
}
var options=["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!
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 username or e-mail address. We'll send you an e-mail with instructions to reset your password.