Search code examples
javascriptcsstwitter-bootstrapbootstrap-select

Bootstrap-select is not working with Bootstrap 5


I followed the Getting Started guide from their official webpage

I added the JS and CSS libraries to my project and it does not work.

For some reason selectpicker is set to display: none!important:

enter image description here

    .bootstrap-select>select.bs-select-hidden, select.bs-select-hidden, select.selectpicker {
        display: none!important;
    }

And I am getting this error:

enter image description here

Caused by this JS: <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap-select.min.js"></script>

What I've tried:

  • Even if I change the code to display: block bootstrap-select it is still not working.
  • Changing the order of the imports as suggested in another SO question

I already checked this previous SO question and I changed the order of the imports but still, it is not working.

JS FIDDLE DEMO


Solution

  • Solved, apparently the version I was using is not compatible with BS5

    What I did:

    script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.14.0-beta2/js/bootstrap-select.min.js"></script>

    Use version 1.14.0-beta2 instead of 1.13.14