dschreij I am curious to know how you solved this since I have the same problem!
I don't remember exactly to which survey this question related to exactly, as I've created a lot of similar surveys with complex loop structures in the meantime. If I remember correctly, if I didn't want to show a question on a certain iteration, I used this piece of code:
Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/
});
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Place your JavaScript here to run when the page is fully displayed*/
if (parseInt("${lm://CurrentLoopNumber}") === 1) {
jQuery("#"+this.questionId).hide();
this.clickNextButton()
}
});
where the number after the
===of course corresponds to the iteration you want to skip. Basically this script simply hides the question from view and clicks the next button, effectively skipping the slide.
dschreij Thanks, how do I change it so that it does that for a range of values, or merely for all loop counts under/over a certain value?
Is it something like ==< ? I am not familiar with using three equal signs in this manner.
Haha yes, that's a JavaScript thingy (see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators) but you might as well use double quotes in this situation. You could use a range operator as you suggested. If you really only want to skip the display on specified iterations, you could use
if ([20, 40, 60].includes(parseInt("${lm://CurrentLoopNumber}"))) {...}
Beware though that the includes method does/did not exist on Internet Explorer yet, so this will only work in modern browsers (which people should use anyway).
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.