1 week ago

option value not visible in select2 dropdown

Posted 1 week ago by noblemfd

In my Laravel-5.8 I am using Select2 dropdown list

              <select class="form-control select2bs4" data-placeholder="Choose Nationality" tabindex="1" name="nationality_id" style="width: 100%;">
                <option value="">Select Nationality</option>
                     @if($nationalities->count() > 0 )
                     @foreach($nationalities as $nationality)
                       <option value="{{$nationality->id}}">{{$nationality->nationality}}</option>

        $(function () {
          //Initialize Select2 Elements

          //Initialize Select2 Elements
            theme: 'bootstrap4'

It loads the nationalities, but I didn't see this:

<option value="">Select Nationality</option>

in the select2 dropdown?

How do I resolve this?


Please sign in or create an account to participate in this conversation.