Last active
October 23, 2022 15:11
-
-
Save marketinview/a42e22ccd4244fad03c1e2c9ca17d065 to your computer and use it in GitHub Desktop.
Qualtrics: Hide/Show Next Question Based On Drop-Down. #qualtrics #js #jq #dropdown #select #hide #show #next
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Qualtrics.SurveyEngine.addOnload(function () { | |
//Hide or show next question based on drop down (select) | |
var q = jQuery("#"+this.questionId); | |
var next = q.nextAll('.Separator:first, .QuestionOuter:first'); //next separator & question | |
var select = q.find('select:first'); //select element | |
hideShow(select.get(0)); //initialize to support prev button | |
select.on('change', function() { hideShow(this); }); | |
function hideShow(selEl) { | |
var selIdx; | |
(selEl.selectedIndex < 0) ? selIdx = 0 : selIdx = selEl.selectedIndex; | |
var selText = selEl.options[selIdx].text; | |
if (selText == 'Others' || selText == '') next.hide(); | |
else next.show(); | |
selEl.blur(); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See additional Qualtrics solutions at: https://qualtricswiki.tgibbons.com/doku.php