JSFiddle - React, Tailwind, and code Playground

by Eric Hynds

HTML

<select multiple>
    <option selected>green</option>
    <option>red</option>
    <option selected>orange</option>
    <option>yellow</option>
</select>

JavaScript

$("select option").each(function(){
    var $this = $(this);
    
    $(document.body)
        .append('<p>'+$this.text()+': '+$this.is(':selected')+'</p>');
});