JSFiddle - React, Tailwind, and code Playground
HTML
<select id="company">
<option selected="true" value="">ALL</option>
<option>GM</option>
<option>Honda</option>
<option>Ford</option>
</select>
<select id="names" multiple="multiple" size="8">
<option>Chevy [GM]</option>
<option>Buick [GM]</option>
<option>Civic [Honda]</option>
<option>Accord [Honda]</option>
<option>Focus [Ford]</option>
</select>
JavaScript
$('#company').change(function() {
var make = $(this).val();
$('#names').contents().each(function() {
if (this.nodeType == 8 && this.nodeValue.length > 0 && this.nodeValue.indexOf(make) != -1) {
$(this).before('<option>' + this.nodeValue + '</option>');
$(this).remove();
}
else if ($(this).val().indexOf(make) == -1 && $(this).val().length > 0) {
$(this).replaceWith('<!--' + $(this).val() + '-->');
}
});
});