I\'m trying to add some CSS ::before
content to the tags of a
depending on if the option is sel
Ideally I was looking for a pure CSS solution but as per the comments and @weBer
The tag can only contain:
Zero or more
Therefore I will probably end up using a JavaScript solution like the below.
document.getElementById("multiSelect").onchange = function() {
var opts = this.getElementsByTagName("option");
for (var i = 0; i < opts.length; i++) {
if (opts[i].selected === true) {
opts[i].innerHTML = "SELECTED: " + opts[i].value;
} else {
opts[i].innerHTML = "excluded: " + opts[i].value;
}
}
};
select {
height: 10em;
width: 10em;
overflow-y: hidden;
}