为什么bootstrap multiselect不加载任何东西

时间:2015-08-19 18:50:39

标签: jquery twitter-bootstrap bootstrap-multiselect

我有一个带有select选项标签的简单表单,我正在尝试使用bootstrap multiselect来设置它。不幸的是,似乎没有加载bootstrap multiselect或其他东西......所有我得到的是clasic html select multi box ...

这是我的代码:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="CSS/main.css" rel="stylesheet" type="text/css" />
<link href="CSS/bootstrap-multiselect.css" rel="stylesheet" type="text/css" />
<link href="CSS/bootstrap-3.3.2.min.css" rel="stylesheet" type="text/css" />
<link href="CSS/bootstrap-theme.min.css" rel="stylesheet" type="text/css" />
<link href="CSS/prettify.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="JS/jquery-2.1.3.min.js"></script>
<script type="text/javascript" src="JS/bootstrap-multiselect.js"></script>
<script type="text/javascript" src="JS/bootstrap-3.3.2.min.js"></script> 
<script type="text/javascript" src="JS/prettify.js"></script> 
<script type="text/javascript" src="JS/main.js"></script> 

</head>

<body>

<div>

<form id="tablefilterselect"  method="POST" action="http://localhost/admincrud/php/tablefilterview.php">
<br><br><br>
Select columns: <br><br>

<select class="multiselect" name = "coloaneselect" multiple="multiple" >
 <option value="cheese">Cheese</option>
    <option value="tomatoes">Tomatoes</option>
    <option value="mozarella">Mozzarella</option>
    <option value="mushrooms">Mushrooms</option>
    <option value="pepperoni">Pepperoni</option>
    <option value="onions">Onions</option>
</select>

<br><br>
<input name="customtablesubmit" type="submit" value="Submit">
</form>

</div>
</body>
<script type="text/javascript">
    $(document).ready(function() {
        $('#coloaneselect').multiselect({

            includeSelectAllOption: true,
            enableFiltering: true

        });
    });
</script>

可以请有人帮助我吗?我在这里做错了什么?

2 个答案:

答案 0 :(得分:4)

  

我在这里做错了什么?

bootstrap-multiselect加载之前,您已加入bootstrap脚本

<script type="text/javascript" src="JS/bootstrap-multiselect.js"></script>
<script type="text/javascript" src="JS/bootstrap-3.3.2.min.js"></script>

确保先包含bootstrap ...

<script type="text/javascript" src="JS/bootstrap-3.3.2.min.js"></script> 
<script type="text/javascript" src="JS/bootstrap-multiselect.js"></script>

此外,您有一个<script></script>块作为<body></body>部分的兄弟。 <script>块只能作为<head><body>部分中的后代放置。

<html>

    <head>
        ....
    </head>

    <body>
        ....
        <script>
            ....
        </script>
    </body>

</html>

答案 1 :(得分:0)

检查一下!

<select class="multiselect" name = "coloaneselect[]" multiple="multiple" >