Hi @HenrikeS ,
It has been some time since this question was posted, so you may not require this suggestion.
I came up with the code below while taking reference from some past threads.
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
/*Hide all option at the start, using 31 here as your example is 10+12+9*/
for (let i = 1; i <= 31; i++) {
jQuery("#"+this.questionId+" inputnchoiceid="+ i+ "]").closest("li").hide();
}
/* Change QID*/
let abovechoice="${q://QID22/ChoiceGroup/SelectedChoices}";
/* This is the first group, change the number 10 if required*/
if (abovechoice==="1") {
for (let i = 1; i <= 10; i++) {
jQuery("#"+this.questionId+" inputnchoiceid="+ i+ "]").closest("li").show();
}
}
/* This is the second group, change the number 11 and 22 if required*/
else if (abovechoice==="2"){
for (let i = 11; i <= 22; i++) {
jQuery("#"+this.questionId+" inputnchoiceid="+ i+ "]").closest("li").show();
}
}
/* Copy the second group and paste here if you need more groups.
/* This is the last group, change the number 23 and 31 if required*/
else {
for (let i = 23; i <= 31; i++) {
jQuery("#"+this.questionId+" inputnchoiceid="+ i+ "]").closest("li").show();
}
};
});
Hope it helps.
When I have time consuming logic to program, I tend to use the API.
In your case, set the display logic on one choice to have an example and then use the get question and update question API to modify your question.
See https://api.qualtrics.com/1ebd0bb7008f8-get-question and https://api.qualtrics.com/00d49b25519bb-update-question
@Chee Heng_SZ
@vgayraud
Thank you so much for your replies!
I will test them both and then come back to this thread.
:) h.