Question
Select2 Text Entry Form Multi-Select Dropdown
I am using javascript to transform a text entry form field into a dropdown list and I need to make it multi-select. I know I will need to use Select2 and I have loaded the following into the header:
```
<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>
```
I've read through a lot of the Select2 material, but haven't quite figured it out yet. How would I adapt this code to make the last form field multi-select.
```
Qualtrics.SurveyEngine.addOnReady(function()
{
/*Creates dropdown lists for form text entry boxes*/
var that=this.questionId;
var element="<select id='s1'><option ></option><option value=OPTION1</option><option value='2'>OPTION2</option><option value='3'>OPTION3<option value='4'>OPTION4<option value='5'>OPTION5</select>";
jQuery(element).insertAfter("#"+that+" .InputText:eq(3)");
var element="<select id='s2'><option ></option><option value='1'>OPT1</option><option value='2'>OPT2</option><option value='3'>OPT3<option value='4'>OPT4<option value='5'>OPT5<option value='6'>OPT6<option value='7'>OPT7<option value='8'>OPT8<option value='9'>OPT9<option value='10'>OPT10</select>";
jQuery(element).insertAfter("#"+that+" .InputText:eq(4)");
jQuery("#"+that+" .InputText:eq(3)").hide();
jQuery("#"+that+" .InputText:eq(4)").hide();
jQuery("#"+that+" .InputText:eq(3)").val(jQuery("#s1 option:selected").text());
jQuery("#"+that+" .InputText:eq(4)").val(jQuery("#s2 option:selected").text());
jQuery("#s1").on('change',function(){
jQuery("#"+that+" .InputText:eq(3)").val(jQuery("#s1 option:selected").text());
});
jQuery("#s2").on('change',function(){
jQuery("#"+that+" .InputText:eq(4)").val(jQuery("#s2 option:selected").text());
});
});
```
Thanks!
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.

