Answers for "select2 get selected option"

2

get select2 selected value

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

select2 preselect option

$('#mySelect2').val('1'); // Select the option with a value of '1'
$('#mySelect2').trigger('change'); // Notify any JS components that the value changed
Posted by: Guest on November-09-2020
1

select2 find option by value

$('#Select2ID option[value="actualVal"]).text()
Posted by: Guest on September-17-2021
0

select2 multi select get selected value

alert("Selected value is: "+$(".leaderMultiSelctdropdown").select2("val"));

alternatively, if you used a regular selectbox as base, you should be able to
use the normal jquery call, too:

alert("Selected value is: "+$(".leaderMultiSelctdropdown").val());
Posted by: Guest on May-17-2021

Code answers related to "select2 get selected option"

Code answers related to "Javascript"

Browse Popular Code Answers by Language