Here is the code snippet I am working with:
HTML:
<div id="myDiv" class="container">
....
</div>
CSS:
div.container {
width: 300px;
height: 400px;
border: solid 1px black;
overflow: hidden;
background: #efefef;
}
JS:
var myDiv = document.getElementById("myDiv");
var pageWidth = parseInt(myDiv.style.width);
I am trying to read and change CSS properties using JavaScript. However, when I searched on Google for a solution and implemented the JS code from a link, I encountered an issue while inspecting in Safari's web inspector. The problem seems to be related to how I applied the JS code. Can someone help me understand what went wrong here?