How to run Bootstrap-select with bootstrap 5 without this error

2.1k views Asked by At

I'm using Bootstrap 5 on a project (template based) and when I tried to include bootstrap-select (version 1.13.14) but the console returns the following errors:

Uncaught TypeError: Cannot read properties of undefined (reading 'Constructor') ---- bootstrap-select.js:3133

The line in question reads:

// get Bootstrap's keydown event handler for either Bootstrap 4 or Bootstrap 3
var bootstrapKeydown = $.fn.dropdown.Constructor._dataApiKeydownHandler || $.fn.dropdown.Constructor.prototype.keydown;

As a result, the select element with class selectpicker won't show up.

Any thoughts or ideas? Thanks!

1

There are 1 answers

0
ArtFranco On

Well... solved it by using the bootstrap-select version 1.14-beta. Found the answer in this thread: https://github.com/snapappointments/bootstrap-select/issues/2439

But notice that this is a beta version.