Bootstrap-select does not switch the "open" class

Please look → FIDDLE

I downloaded the source from http://silviomoreto.imtqy.com/bootstrap-select/ , I really don’t know why it doesn’t switch the “open” class .dropdown-toggle “I can fix this by adding some dirty scripts, but I I prefer the plugin to work correctly.

HTML:

<div class="number customdp"> <select class="simple-dropdown" name="number"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> </select> 

Anyone have a solution?

+7
jquery twitter-bootstrap bootstrap-select
source share
3 answers

He has a dependency on twitter bootstrap. Add CSS and JavaScript files, for example:

 <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css"> <!-- Latest compiled and minified JavaScript --> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> 

See this updated script with CSS and JS enabled, and it seems to be working fine.

+9
source share

I had the same problem. Even after the links were correct, the drop-down list did not show on click. So I included the following code and it worked.

  $(document).ready(function () { $(".selectpicker").selectpicker(); $(".bootstrap-select").click(function () { $(this).addClass("open"); }); }); 
+6
source share

For a better solution, include all the JS files at the bottom of the body with the following order:

  • JQuery
  • Bootstrap
  • Bootstrap-select
0
source share

All Articles