Aym*_*ine 8 jquery twitter-bootstrap
我想使用bootstrap multi select插件:Bootstrap Multiselect
但它不适合我.
<script type="text/javascript" src="dist2/js/bootstrap-multiselect.js"></script>
<link rel="stylesheet" href="dist2/css/bootstrap-multiselect.css" type="text/css"/>
<script type="text/javascript">
$(document).ready(function(){
$('#doc_1').multiselect();
});
</script>
Run Code Online (Sandbox Code Playgroud)
Ind*_*ndi 15
今天我在编写样本来测试Bootstrap的multiselect时遇到了同样的问题,即使在我的.cshtml中以正确的顺序引用文件之后也是如此.
事实证明我曾两次引用jquery库,一旦我纠正了它,它开始工作正常.有时使用Chrome开发工具您无法看到加载两次的库,但是,如果您右键单击页面并查看源,您可以看到它是否重复.
Jai*_*Jai 12
你需要在你的插件之前有一个jquery库和bootstrap库:
<!-- Include Twitter Bootstrap and jQuery: -->
<link rel="stylesheet" href="css/bootstrap.min.css" type="text/css"/>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<!-- Include the plugin's CSS and JS: -->
<script type="text/javascript" src="js/bootstrap-multiselect.js"></script>
<link rel="stylesheet" href="css/bootstrap-multiselect.css" type="text/css"/>
Run Code Online (Sandbox Code Playgroud)
您应该始终将css放在任何脚本之前.
在index.html中包含以下JQuery和Bootstrap文件.
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.13/css/bootstrap-multiselect.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-2.2.0.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.13/js/bootstrap-multiselect.js"></script>
Run Code Online (Sandbox Code Playgroud)