I know similar questions have been asked, like this one, but I've not been able to find a solution that works.
Can someone suggest how I could fetch the value of the width attribute from the CSS class so I can write it to the div?
I want to fetch the actual value set in the class, even if the actual element has been stretched further due to content.
Happy to do this with jQuery if possible.
document.getElementById("myDiv").innerHTML = 'value of CSS width';
#myDiv {
width: 177px;
border: 1px solid red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="myDiv">Hello World!</div>