bootstrap modal with select2 z-index

Mustafa Magdy picture Mustafa Magdy · Jul 24, 2015 · Viewed 13.1k times · Source

I'm trying to load content from different html page to a popup then applying select2 on it.

everything is working, but the z-index for the select2 is not correct, event if I modified it to bigger value than bootstrap dialog is.

enter image description here

here is a snippet of what I'm doing

.select2-dropdown {  
  z-index: 10060 !important;/*1051;*/
}

Any Ideas ?

Answer

Dan picture Dan · Jul 3, 2018

Combining a couple solutions found on the Select2 GitHub issue tracker seems to get Select2 v4 working with Bootstrap modals.

Add this css...

.select2-container--open {
    z-index: 9999999
}

Then I was still unable to type in the search box... removing the "tabindex" attribute from the modal div fixed that.