Solved
Formatting multi-selects in Select2 code
Hi - I have a multi-select question that uses select2: https://select2.org/placeholders
But I'm having some trouble doing 3 things:
1) Placeholder. I want to show a default message in the dropdown. I've added
`$('select').select2({
placeholder: {
id: '-1', // the value of the option
text: 'Select an option'
}
});`
into the JS for the question but that's not working.
2) Option groups. I want to have some answer options appearing under multiple bolded category heading, but does optgroup only work in html? How do I add it in JS to a Qualtrics question?
3) Font. By default, the drop down appears in a different font to the rest of the survey text. How do I change this?
Am I better off just learning JS...? 😀
thanks
Dan
Best answer by TomG
@danpenny,
If you expect to use JS (e.g. select2) in your surveys, then you should learn JS.
1. Placeholder:
```
jqObj.select2({ placeholder: "Select an option" });
```
2. Option groups: put your question in Multiple Answer mode, right click choices and assign to groups. After you have your groups set up, switch question to Multi Select Box.
3. Font: Add a style for .select2Dropdown in your Look & Feel CSS.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
