Roomal Jayaratne
Roomal Jayaratne

Reputation: 51

How to use gentelella alela select2 option in laravel

I found they have select2 file in their vendor folder, so i linked them (those links works when i open these two files in web browser). in header

 <link href="{{asset('adminbackend/vendors/select2/dist/css/select2.min.css')}}" rel="stylesheet">

in Footer

<script src="{{asset('adminbackend/vendors/select2/dist/js/select2.full.js')}}"></script>

in body

 <div class="item form-group">
                        <select class="form-control select2-multi" name="tags[]">
                            @foreach($tags as $tag)
                            <option value="{{$tag->id}}"> {{$tag->name}} </option>
                            @endforeach
                        </select>
                    </div>

in body

<script type="text/javascript">
$(.select2-multi').select2();
</script>

but, still it not working.. this code found in here https://www.youtube.com/watch?v=BNUYaLWdR04&list=PLwAKR305CRO-Q90J---jXVzbOd4CDRbVx&index=43

Upvotes: 1

Views: 451

Answers (1)

Athira Kadampatta
Athira Kadampatta

Reputation: 91

It could be the missing quote in the script.

$(document).ready(function() {
   $('.select2-multi').select2(); 
});

Could you try this?

Upvotes: 1

Related Questions