I have multiple select that contains options of languages and I want to get the values selected.
I tried that using by retrieve the value from the id but nothing shown in the console.
$('#language').select2();
<select id="language" class="form-control" multiple="multiple" data-toggle="select2">
<option value="1">FR</option>
<option value="1">Eng</option>
<option value="1">Es</option>
</select>
var selectedValues = $('#language').val();
console.log(selectedValues);
2
Answers
You can try this..
will give you the array of values of selected options.
Here is a demo: