JSFiddle - React, Tailwind, and code Playground
HTML
<div id="myDiv">
This div has a scroll bar.
</div>
<br />
<div id="results">
</div>
CSS
#myDiv {
width: 200px;
overflow-y: scroll;
}
JavaScript
// Webkit browsers return viewports not including the scrollbar when looking in element.style.width
// jQuery corrects for this but forgets to when the case is not lowercase only.
var lowerOnly = $("#myDiv").css("width");
var mixedCase = $("#myDiv").css("wIdTh");
$("#results").html("width: " + lowerOnly + " <br /> " + "wIdTh: " + mixedCase);