[英]jquery.min.js:2 Uncaught TypeError: $(…).select2 is not a function
Form for the selection this form look like selection and then select the code 选择表单此表单看起来像选择,然后选择代码
<div class="form-group">
<label>Multiple</label>
<select class="form-control select2 select2-hidden-accessible" multiple="" data-placeholder="Select a State" style="width: 100%;" tabindex="-1" aria-hidden="true" name="select2">
<option>Alabama</option>
<option>Alaska</option>
<option>California</option>
<option>Delaware</option>
<option>Tennessee</option>
<option>Texas</option>
<option>Washington</option>
</select>
</div>
This is the link Code error is here error comes on javaScript Function 这是链接代码错误,javaScript函数附带错误
@section('footerSection')
<script language="JavaScript" type="text/javascript" src="{{ asset('/admin/bower_components/select2/dist/js/select2.full.min.js')}}"></script>
<script language="JavaScript" type="text/javascript" src="{{ asset('/admin/bower_components/jquery/dist/jquery.min.js')}}"></script>
<script type="text/javascript">
$( document ).ready(function() {
$(".select2").select2();
});
</script>
@endsection
You need to switch the src order. 您需要切换src顺序。 select2 is probably trying to use jquery before it is defined.
select2可能在定义它之前尝试使用jquery。
<script language="JavaScript" type="text/javascript" src="{{ asset('/admin/bower_components/jquery/dist/jquery.min.js')}}"></script>
<script language="JavaScript" type="text/javascript" src="{{ asset('/admin/bower_components/select2/dist/js/select2.full.min.js')}}"></script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.