JSFiddle - React, Tailwind, and code Playground
HTML
<select id='select' size='10' multiple='multiple'>
<option value='asdf'>Opt 1</option>
<option value='asdf2'>Opt 2</option>
<option value='asdf3'>Opt 3</option>
</select>
JavaScript
var selectList = $("#select");
var getCurrent = function (e) {
currentSelections = selectList.find(':selected');
var vals = [];
for (var x = 0; x < currentSelections.length; x += 1) {
vals.push($(currentSelections[x]).html());
}
console.log(e, vals.join(', '));
}
selectList.click( function () {
getCurrent('click: ');
});
selectList.mouseup( function () {
getCurrent('mouesup: ');
});
selectList.change( function () {
getCurrent('change: ');
});
if (selectList[0].attachEvent) {
selectList[0].attachEvent('onchange', function () {
getCurrent('onchange: ');
});
}