Answers for "how to set value of select2 in jquery"

0

jquery to set value in select2 dropdown button

$("#u20_cre").select2().val(["1","6"]).trigger("change");
Posted by: Guest on January-09-2021
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

Code answers related to "how to set value of select2 in jquery"

Code answers related to "Javascript"

Browse Popular Code Answers by Language