JSFiddle - React, Tailwind, and code Playground

HTML

<select>
    <option value="Bar">Bar</option>
    <option value="foo">foo</option>
</select>

<input type="text" id="f2" value="foo"/>

JavaScript

$("input").keyup(function() {
    if ($('select option[value="' + $(this).val() + '"]').length) {
        // do something
        $('select').val($(this).val());
    }
});

alert($('select option').val().toLowerCase());