JSFiddle - React, Tailwind, and code Playground

HTML

<input id="someinput">
<br/>
<select class="select-cities" name="city" id="optlist" multiple="multiple">
    <option>Frederiksberg</option>
    <option>Vanløse</option>
    <option>Glostrup</option>
    <option>Brøndby</option>
    <option>Roskilde</option>
    <option>Køge</option>
    <option>Gentofte</option>
    <option>Hillerød</option>
    <option>Tårnby</option>
    <option>Vallensbæk</option>
</select>
</input>
<br/>
<select class="chosen-cities" name="chosen-cities-name" multiple="multiple"></select>

JavaScript

$(function () {
    opts = $('#optlist option').map(function () {
        return [[this.value, $(this).text()]];
    });


    $('#someinput').keyup(function () {
        var rxp = new RegExp($('#someinput').val(), 'i');
        var optlist = $('#optlist').empty();
        opts.each(function () {
            if (rxp.test(this[1])) {
                optlist.append($('<option/>').attr('value', this[0]).text(this[1]));
            } else{
                optlist.append($('<option/>').attr('value', this[0]).text(this[1]).addClass("hidden"));
            }
        });
        $(".hidden").toggleOption(false);
    });
    $('.select-cities').click(function () {
        $('.select-cities option:selected').remove().appendTo('.chosen-cities');
        opts = $('#optlist option').map(function () {
            return [[this.value, $(this).text()]];
        });
    });

    $('.chosen-cities').click(function () {
        $('.chosen-cities option:selected').remove().appendTo('.select-cities');
        opts = $('#optlist option').map(function () {
            return [[this.value, $(this).text()]];
        });
    });


});

jQuery.fn.toggleOption = function( show ) {
    jQuery( this ).toggle( show );
    if( show ) {
        if( jQuery( this ).parent( 'span.toggleOption' ).length )
            jQuery( this ).unwrap( );
    } else {
        if( jQuery( this ).parent( 'span.toggleOption' ).length == 0 )
            jQuery( this ).wrap( '<span class="toggleOption" style="display: none;" />' );
    }
};