Skip to content Skip to sidebar Skip to footer

Select2 Jquery Plugin In Popup?

I have two select tag implement select2 jquery plugin: select tag normal: working fine, can search. select tag in popup: cant search. Any helps. Thanks.

Solution 1:

You have given tabindex="-1" for the modal. Because of this input is not getting focussed. Remove tabindex from your code and it should work.

Also there are following issues in your code

  • you have included bootstrap and select2 js files multiple times your HTML. Include only once.
  • Include your jquery file before including bootstrap js file.
  • You are using categoryID multiple times your HTML page. IDs has to be unique.

Solution 2:

This Works for me

    <script>
        $('#mySelect2').select2({
            dropdownParent: $('#myModal')
        });
    </script>

Source from:

Select2 web


Solution 3:

From everyone who search an answer when you use select2 + SweetAlert2 extension. The come around solution is to alter the style of the dropdown container, inside the event 'select2:open'.

$('select[name=extension]').on('select2:open', ()=>{
    $('.select2-container').css('z-index', 99999999);
})

Post a Comment for "Select2 Jquery Plugin In Popup?"