Answers for "set selected value in select2 multiple"

0

how to set value select2

$('#sel_users').select2().trigger('change');

$(document).ready(function(){

  // Initialize Select2
  $('#sel_users').select2();

  // Set option selected onchange
  $('#user_selected').change(function(){
    var value = $(this).val();

    // Set selected 
    $('#sel_users').val(value);
    $('#sel_users').select2().trigger('change');

  });
});
Posted by: Guest on March-16-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 "set selected value in select2 multiple"

Code answers related to "Javascript"

Browse Popular Code Answers by Language