Html – Bootstrap select not working

csshtmltwitter-bootstrap

I have something like this:

<select class="selectpicker" name="level">
<option value="Field">Field admin</option>
<option value="Text">Text admin</option>
<option value="Bot">Bot</option>
</select>

With this at the bottom:

<script src='./clientLib/bootstrap-select.js'></script>

Adding this (at the bottom of the page after loading the above script) doesn't work:

 $('.selectpicker').selectpicker();

Right now, the button gets formatted but clicking the select does not load the drop down. Pressing alt loads the drop down but there is no way to close the dropdown, even if I select an option.

Anyone have any ideas on why this is happening?

Best Solution

Try to load the script in the head section of the page and this '$('.selectpicker').selectpicker();' at the bottom of the page