Solved
Select2 Implementation
Hi
Could someone give me some quick help with something pretty basic - I want to implement Select2 on a Qualtrics survey, so that respondents can multi-select from a drop-down, but I'm not quite sure how to set it up.
I've added
link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css" rel="stylesheet" /
script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js" /script
to my survey header - is that correct?
And then in my multi-select question I have this added as JS:
Qualtrics.SurveyEngine.addOnReady(function() {
$('.js-example-basic-multiple').select2();
});
But that's not doing much other than showing the answer choices in a box, so I must be missing a step.
Do I need to add the css script too somehow and somewhere? What is this and how do I do it?
Could someone give me some quick help with something pretty basic - I want to implement Select2 on a Qualtrics survey, so that respondents can multi-select from a drop-down, but I'm not quite sure how to set it up.
I've added
link href="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/css/select2.min.css" rel="stylesheet" /
script src="https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js" /script
to my survey header - is that correct?
And then in my multi-select question I have this added as JS:
Qualtrics.SurveyEngine.addOnReady(function() {
$('.js-example-basic-multiple').select2();
});
But that's not doing much other than showing the answer choices in a box, so I must be missing a step.
Do I need to add the css script too somehow and somewhere? What is this and how do I do it?
Best answer by TomG
> @danpenny said:
> Thanks v much TomG!
>
> Ok, I've added that JS, replacing this.questionId with Q3. But the question still operates like a normal drop-down, only allowing me to select one answer. Any other suggestions on what I may be missing? I really appreciate this.
Do NOT replace the variable this.questionId, Q3 is not a valid QID. Use the script as I posted it (unless you need to add select2 options). Also, make sure your question is a Multi Select Box:
!
View original> Thanks v much TomG!
>
> Ok, I've added that JS, replacing this.questionId with Q3. But the question still operates like a normal drop-down, only allowing me to select one answer. Any other suggestions on what I may be missing? I really appreciate this.
Do NOT replace the variable this.questionId, Q3 is not a valid QID. Use the script as I posted it (unless you need to add select2 options). Also, make sure your question is a Multi Select Box:
!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.