Using Select2 in Drill Down Questions | XM Community
Solved

Using Select2 in Drill Down Questions

  • 12 August 2019
  • 2 replies
  • 106 views

Userlevel 5
Badge +33
I have a drill down question in which I would like respondents to have the ability to start typing text and pull up matching answer choices to select from. I've seen other posts mention that using Select2 allows for this kind of functionality (I am a novice when it comes to using JavaScript). However, when I enter the following into the JavaScript for the question the search box only appears for the first item in the drill down and not the second. Any suggestions?

var options = {
placeholder: 'Select an option'
};
jQuery("#"+this.questionId).find('select:first').select2({options});
icon

Best answer by TomG 12 August 2019, 17:52

View original

2 replies

Userlevel 7
Badge +27
select:first only returns the first select. If you remove :first it will return all the selects.
Userlevel 5
Badge +33
Great, thank you! That worked!

Leave a Reply