[英]Select2 Multiple select boxes not working
I am using Select2 as part of a laravel project. 我正在使用Select2作为laravel项目的一部分。 The problem I am having is that it is not responding.
我遇到的问题是它没有响应。 Here is a picture.
这是一张照片。
It is the schools box. 它是学校的盒子。 This does not look right.
这看起来不对。 Below is my code.
下面是我的代码。
{{ Form::label('schools', 'Schools:') }}
<select class="form-control multi" name="schools" multiple="multiple">
@foreach($schools as $school)
<option value='{{ $school->id }}'>{{ $school->name }}</option>
@endforeach
</select>
{{ form::label('email', 'Email:') }}
{{ form::text('email', null, array('class' => 'form-control', 'required' => '')) }}
{{ form::submit('Create New Member', array('class' => 'btn btn-success btn-lg btn-block', 'style' => 'margin-top: 20px;')) }}
{!! Form::close() !!}
</div>
</div>
@endsection
@section('scripts')
{!! Html::script('js/parsley.min.js') !!}
{!! Html::script('js/select2.min.js') !!}
<script type="text/javascript">
$('.multi').select2();
</script>
have you tried Aravindh Gopi's suggestion? 您是否尝试过Aravindh Gopi的建议? Replace your script tag this:
替换您的脚本标签:
<script type="text/javascript">
$(document).ready(function () {
$('.multi').select2();
});
</script>
Make sure that the script above written right before the body close tag 确保上面的脚本写在body close标签之前
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.