This following code snippet is to avoid the need for ctrl-click in a multi-select box
but it does not work in IE 8 .
Is there any work around to achive the same
I found one major issue with jQuery answer above. The .val()
of the $(select)
won't update.
Here is working solution:
$select.mousedown(function (e) {
e.preventDefault();
const select = this;
const { scrollTop } = select;
e.target.selected = !e.target.selected;
setTimeout(function () {
select.scrollTop = scrollTop;
}, 0);
}).mousemove(function (e) { e.preventDefault(); });