JSFiddle - React, Tailwind, and code Playground
HTML
<div id='box1'>
<div id='box2'>
</div>
</div>
<p id="w"></p>
<p id="iw"></p>
CSS
#box1 {
width:100px;
height:100px;
overflow:auto;
}
#box2 {
width:200px;
height:200px;
background-color:#aaa;
}
JavaScript
$('#box1').html("<img src='http://lorempixel.com/output/people-h-c-1449-1723-4.jpg' />");
var helperDiv = $('<div />');
$('#box1').append(helperDiv);
$('#iw').text("inner width is: " + helperDiv.width());
helperDiv.remove();