Level 27
@noblemfd Have you tried adding a value to that option? Something other than an empty string?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
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>
@endforeach
@endif
</select>
<script>
$(function () {
//Initialize Select2 Elements
$('.select2').select2()
//Initialize Select2 Elements
$('.select2bs4').select2({
theme: 'bootstrap4'
})
});
</script>
It loads the nationalities, but I didn't see this:
<option value="">Select Nationality</option>
in the select2 dropdown?
How do I resolve this?
Thanks
Please or to participate in this conversation.