Bootstrap-select: TypeError: undefined is not an object (evaluating '$.fn.dropdown.Constructor')

Created on 24 Sep 2018  Â·  2Comments  Â·  Source: snapappointments/bootstrap-select

I am trying to use bootstrap-select in a basic HTML page, but I'm getting the following error:

There was an issue retrieving Bootstrap's version. Ensure Bootstrap is being loaded before bootstrap-select and there is no namespace collision. If loading Bootstrap asynchronously, the version may need to be manually specified via $.fn.selectpicker.Constructor.BootstrapVersion.
TypeError: undefined is not an object (evaluating '$.fn.dropdown.Constructor')
(anonymous function) — bootstrap-select.js:379
(anonymous function) — bootstrap-select.js:2734
(anonymous function) — bootstrap-select.js:21
Global Code — bootstrap-select.js:23

I am not loading bootstrap-select asyc, however I am attempting to add the line that was suggested by the error message, but I'm unclear on where and in which file this should be added:

$.fn.selectpicker.Constructor.BootstrapVersion = '4';

I'm not using a framework, I'm just trying to get this working in an HTML page. Do I insert this line into bootstrap-select.js, if so where? Or is it supposed to be an inline script in the HTML document?

Here are the scripts being loaded:

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<link rel="stylesheet" href="now-ui-kit.css">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="assets/css/bootstrap-select.min.css">
<!-- Latest compiled and minified JavaScript -->
<script src="assets/js/bootstrap-select.js"></script>
<!-- (Optional) Latest compiled and minified JavaScript translation files -->
<script src="assets/js/i18n/defaults-*.min.js"></script>

Most helpful comment

Simply load it after the last bootstrap-select file.

<script>
$.fn.selectpicker.Constructor.BootstrapVersion = '4';
</script>

All 2 comments

Simply load it after the last bootstrap-select file.

<script>
$.fn.selectpicker.Constructor.BootstrapVersion = '4';
</script>

I've this issue too, what can it caused and how can i fixed it?

Uncaught TypeError: z.fn.dropdown is undefined
    <anonymous> bootstrap-select.js:3133
    <anonymous> bootstrap-select.js:3152
    <anonymous> bootstrap-select.min.js:8
    <anonymous> bootstrap-select.min.js:8
Was this page helpful?
0 / 5 - 0 ratings