最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Bootstrap multiselect drop down list is not showing - Stack Overflow

programmeradmin0浏览0评论

I am trying to create a multi selectable list which looks something like this

This is my HTML:

<select multiple="multiple" id="months">
    <option value="1">January</option>
    <option value="12">December</option>
</select>

This is my javascript:

$(document).ready(function () {
    $('#months').multiselect();
});

The view I get from the code seems to be fine:

However, when I click on it, the drop down list won't e out! What could be the reason? I am using the following plugin Bootstrap Multiselect

I am trying to create a multi selectable list which looks something like this

This is my HTML:

<select multiple="multiple" id="months">
    <option value="1">January</option>
    <option value="12">December</option>
</select>

This is my javascript:

$(document).ready(function () {
    $('#months').multiselect();
});

The view I get from the code seems to be fine:

However, when I click on it, the drop down list won't e out! What could be the reason? I am using the following plugin Bootstrap Multiselect

Share Improve this question edited Jan 30, 2018 at 13:09 Melchia 24.3k23 gold badges108 silver badges129 bronze badges asked Jan 30, 2018 at 13:06 JerryBoxJerryBox 1311 gold badge2 silver badges13 bronze badges 5
  • 2 Is there any error return in the console ? – Ayaz Ali Shah Commented Jan 30, 2018 at 13:07
  • Have you included all the required files in the html ? – Vignesh Raja Commented Jan 30, 2018 at 13:08
  • can you post the whole code? – Sanjit Bhardwaj Commented Jan 30, 2018 at 13:10
  • ...or create a fiddle. – Dan_ Commented Jan 30, 2018 at 13:16
  • @Mr.Developer - no. Vignesh Raja - yes. Sanjit Bhardwaj - no, because there would be too much code. It's a large application. – JerryBox Commented Jan 30, 2018 at 13:17
Add a ment  | 

1 Answer 1

Reset to default 5

It's so easy to make it work.
You just have to include jQuery and then Bootsrap as the following simple example :

$(document).ready(function() {
  $('#months').multiselect();
});
<link rel="stylesheet" href="https://cdnjs.cloudflare./ajax/libs/bootstrap-multiselect/0.9.13/css/bootstrap-multiselect.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn./bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://code.jquery./jquery-2.2.0.min.js"></script>
<script src="https://maxcdn.bootstrapcdn./bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare./ajax/libs/bootstrap-multiselect/0.9.13/js/bootstrap-multiselect.js"></script>

<select multiple="multiple" id="months">
    <option value="1">January</option>
    <option value="12">December</option>
</select>

发布评论

评论列表(0)

  1. 暂无评论