I have some code to change the order of my drill down response display. The issue is that when a respondent clicks next to go to the next page, the second drill down answer reverts to the default.
I can think of two ways around this: 1) change the problem with it reverting to default, or 2) set embedded data before the page submission so that the actual response is recorded.
I believe this behaviour is being caused by the on('change'... method but am really stumped about how to fix it.
Qualtrics.SurveyEngine.addOnReady(function () {
$j = jQuery.noConflict();
QID = this.questionId;
$j(document).ready(function () {
const language = "${e://Field/Q_Language}";
$j(document).ready(function () {
let select = $j('#QR\\\\~' + QID + '\\\\~1');
select.html(select.find('option').sort(function (x, y) {
return new Intl.Collator(language, { sensitivity: "variant" }).compare($j(x).text(), $j(y).text());
})).val("");
});
let select2 = $j('#QR\\\\~' + QID + '\\\\~2');
$j('#QR\\\\~' + QID + '\\\\~1').on('change', function () {
select2.html(select2.find('option').sort(function (x, y) {
return new Intl.Collator(language, { sensitivity: "variant" }).compare($j(x).text(), $j(y).text());
})).val("");
});
});
});
Question
Drill down response reverting to default on submit
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
