I tried to implement a multi select box to create tags using the code below. I downloaded select2.min.css
and select2.min.js
from https://github.com/select2/select2, then copied them into the project's css and js folders.
Here is the HTML code snippet I used:
<link rel="stylesheet" href="https:
//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="
{{asset('css/select2.min.css')}}">
<script type="text/javascript" src="{{asset('js/select2.full.min.js')}}">
</script>
<script type="text/javascript"
src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js">
</script>
<script type="text/javascript" src="{{asset('js/select2.min.js')}}">
</script>
<div class="form-group">
<label class="control-label col-sm-2" for="tags">tags:</label>
<select class="form-control select2-multi" name="tags"
multiple="multiple">
@foreach($tags as $tag)
<option value='{{$tag->id}}'>{{$tag->name}}</option>
@endforeach
</select>
</div>
<script>
$('.select2-multi').select2();
</script>
Unfortunately, this code did not work for me. Can you help me fix it? Image of the code can be viewed here: https://i.sstatic.net/QUyoV.png