JSFiddle - React, Tailwind, and code Playground
by Aamir Afridi
HTML
<select name="" id="listbox">
<option value="1">1</option>
<option value="2">3</option>
</select>
JavaScript
$('#listbox option:eq(0)').css('color', 'red').data('color', 'red');
$('#listbox').change(function () {
if ($(this).find("option:selected").data('color') == 'red') {
alert('color is red');
} else {
alert('other options');
}
});