JSFiddle - React, Tailwind, and code Playground
HTML
<div id="myDiv" class="container">
</div>
<input type="button" value="Get Width of myDiv" id="getWidth"/>
<input type="button" value="Set Width of myDiv to 200px" id="setWidth"/>
CSS
div.container {
width: 300px;
height: 400px;
border: solid 1px black;
overflow: hidden;
background: #efefef;
}
JavaScript
$('#getWidth').on('click', function(){
alert($('#myDiv').width());
});
$('#setWidth').on('click', function(){
$('#myDiv').css("width","200px");
alert("New Width : " + $('#myDiv').width());
});