Hi,
I'm trying to integrate select2 into my form to implement multi-select as shown below (where respondents can begin typing responses/scroll through available options and select as many as apply)
I haven't used select2 or Javascript before, so I'm a bit confused on how to implement this. I know I can put the Javascript for including select2 into the 'Edit Question Javascript' section, but I'm not sure:
- Where/how do I include my actual data for all the options? (Is this also in the Question Javascript box, or somewhere else? If somewhere else, where is that and how do I reference that data from the Question Javascript box?)
- How do I make sure that the response data for this question properly goes into the Data & Analysis section of my Qualtrics form?
In another question on here (https://community.qualtrics.com/XMcommunity/discussion/comment/41960#Comment_41960), someone said you can put the data for each of your options in a Javascript object, but would that go within the 'Edit Question Javascript' box as well?
For more detail, the Javascript listed on the select2 website (https://select2.org/getting-started/basic-usage) is as follows:
$(document).ready(function() {
$('.js-example-basic-multiple').select2();
});
But, the select2 tutorial (linked directly above) says you should use HTML to encode the option data, so I'm not sure how the above Javascript should be modified to reference a Javascript object instead of an HTML file?
tl;dr what code do I use? where does it go? (thx in advance)