I have used select2
for my select options to let users search options and enter their custom value if needed. Now I have 2 problems. 1- It shows whatever I search as an option as below. Is there a way to remove the search history?
2- Sometimes I type a new option and and press enter key but it doesn’t show the custom value. The search box becomes empty.
My code:
<select class="form-control" type="text" id="title" name="title">
<option value=""></option>
@foreach($titles as $title)
<option value="{{ $title->id }}">{{ $title->value }}</option>
@endforeach
</select>
$("#title").select2({
tags: true
});