New to JS (and to Qualtrics too).
We have a side-by-side question (Q3) with several columns: one drop-down, 2 text (which it calls one column) , one radio buttons
We need to hide 2 or 3 of the columns IF they responded with a zero or a blank to a previous question (Q1).
Any help greatly appreciated!
If you split up text entry question into two, then you can use the code below, by just changing the QID and choice ids.
Qualtrics.SurveyEngine.addOnReady(function(){
c2 = "${q://QID14/ChoiceTextEntryValue/1}";
c2 = c2.replaceAll(/\\,\\s/gm,"");
if(c2 == 0){
this.getChoiceContainer().querySelectorAll(".SBS2").forEach(item => item.remove());
}
c3 = "${q://QID14/ChoiceTextEntryValue/2}";
c3 = c3.replaceAll(/\\,\\s/gm,"");
if(c3 == 0){
this.getChoiceContainer().querySelectorAll(".SBS3").forEach(item => item.remove());
}
});
Thanks for the answer. As I said I am new to JS.
When I inspect the preview to find the QID it seems to be:
#QR\\~ID8\\#1\\~1\\~1\\~TEXT
How do I translate this into the format of your:
"${q://QID14/ChoiceTextEntryValue/1}"
Thanks
I haven't seen anything like that before. What kind of a question is it?
Don't inspect, use piped text to figure out the replacement.
With your current setup, SBS2 corresponds to the "Number of question" and SBS3 to the yes/no question. So, you'll have to split it into two questions.
Perfect. Thanks!!!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.