Answers for "get value of select2 jquery"

2

get select2 selected value

//initialize
$('#mySelect2').select2('data');
//get selected value
$('#mySelect2').find(':selected');
Posted by: Guest on June-23-2020
2

jquery select2 set value

<select id="lang" >
   <option value="1">php</option>
   <option value="2">asp</option>
   <option value="3">java</option>
</select>

<script>
	$("#lang").select2().select2('val','1');
</script>
Posted by: Guest on May-10-2021
1

Select options of Select2 control based on values using Jquery

$('#mySelect2').val(['1', '2']);
$('#mySelect2').trigger('change'); // Notify any JS components that the value changed
Posted by: Guest on September-16-2021

Code answers related to "get value of select2 jquery"

Browse Popular Code Answers by Language