按ID选择2默认值

I have a select2 dropdown, and I have the id of the option.

How do I set it to the specific id when loading the page?

<script>
  $(document).ready(function() {

    $("#region-select").select2().select2('id', '2');

  });
</script>

Is not doing anything.

Thanks!

Please use val instead of id.

This should work :)

$(document).ready(function() {

  $("#region-select").select2().select2('val', '2');

});