In Qualtrics, I need to implement display logic (not using the Qualtrics GUI) using Javascript in a "Multiple Choice" question in the "Dropdown" format, with that logic selectively hiding a subset of potential choices based on the value of an Embedded variable.
Survey flow:
Example: if "3" was chosen in Question 1, then only "1, 2, 3" would be shown in Question 2.
Below is code that successfully works when the second question is a "List" format, but I cannot determine how to change it to accommodate a "Dropdown" format.
Qualtrics.SurveyEngine.addOnload(function()
{
var threshold = parseInt("${e://Field/embd_threshold}");
for (let i = 1; i <= 5; i++) {
var choiceoption = "QR~QID2~" + i
if (i > threshold) {
$(choiceoption).up().hide();
}
}
});
Note: I need to Use Javascript here because the real application of this problem involves choice options in the hundreds, for which manual use of Qualtrics' GUI to set display logic for every possible choice and condition is impractical.