Aymen Bouhastine Aymen Bouhastine - 1 month ago 37
jQuery Question

bootstrap multiselect : TypeError: $(...).multiselect is not a function

I want to use the bootstrap multi select plugin : Bootstrap Multiselect

but it is not working for me.

<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>

Jai Jai
Answer

you need to have a jquery library and bootstrap library before your plugin:

<!-- 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"/>

Note:

You should always place your css before any script.

Get the reference from here.

Comments