select2 use in popup modal bootstrap 4 and select default option code example
Example 1: select2 in modal not work
//replace it with your script
<script>
$('#mySelect2').select2({
dropdownParent: $('#myModal')
});
</script>
Example 2: enforcefocus select2 modal
// Do this before you initialize any of your modals
$.fn.modal.Constructor.prototype.enforceFocus = function() {};