JSFiddle - React, Tailwind, and code Playground
HTML
<select id="selection2" data-inline="true">
<option value="1">i'm short.</option>
<option value="2">i'm kinda medium...</option>
<option value="3">i'm large, or better: i'm huge!</option>
</select>
CSS
div {
padding: 10px
}
#container2 {
width: 350px;
}
.selection1, .selection2, .selection3, .selection4 {
font-weight: bold;
}
JavaScript
function logWidths() {
$("span.selection1").text($("#selection1").css("width"));
$("span.selection2").text($("#selection2").css("width"));
$("span.selection3").text($("#selection3").css("width"));
$("span.selection4").text($("#selection4").css("width"));
$("span.selection5").text($("#selection5").css("width"));
}
logWidths();
$("select").change(logWidths);