This will work for most of us.
The answer given by Hemanth Palle is the easiest way to do it, It worked for me and the JS code wasn't necessary.
The only problem that I've found is that according to W3Schools, The datalist tag is not supported in Internet Explorer 9 and earlier versions, or in Safari.
amagiDropdown(
{
elementId: 'commonWords',
searchButtonInnerHtml: 'Search',
closeButtonInnerHtml: 'Close',
title: 'Search and Choose',
bodyMessage: 'Please firstly search with textbox below later double click the option you choosed.'
});
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="form-group">
<label for="commonWords">Favorite Word</label>
<select id="commonWords">
<option value="1">claim – I claim to be a fast reader, but actually I am average.</option>
<option value="2" selected>be – Will you be my friend?</option>
<option value="3">and – You and I will always be friends.</option>
</select>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script src="https://rawcdn.githack.com/AmagiTech/amagibootstrapsearchmodalforselect/9c7fdf8903b3529ba54b2db46d8f15989abd1bd1/amagidropdown.js"></script>
If you want to reach your goal with only vanilla js, then I strongly recommend to use Tom Select library which is forked from Selectize.js and then decoupled from jQuery.
If you want to reach your goal with a few updates in your code just do the following
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.6/css/selectize.bootstrap3.min.css" integrity="sha256-ze/OEYGcFbPRmvCnrSeKbRTtjG4vGLHXgOqsyLFTRjg=" crossorigin="anonymous" />
<!-- Be sure to put the links in the right position to avoid dependency issue.-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/selectize.js/0.12.6/js/standalone/selectize.min.js" integrity="sha256-+C0A5Ilqmu4QcSPxrlGpaZxJ04VjsRjKu+G82kl5UJk=" crossorigin="anonymous"></script>
<script>
$(document).ready(function () {
$('select').selectize({
sortField: 'text'
});
});
// to clear the selected value.
$('form').find('.selectized').each(function(index, element) { element.selectize && element.selectize.clear() })
</script>