how to div.width css property using js or jquery?

Xklark

New Member
I have code like this :HTML:\[code\]<div id="myDiv" class="container"> ....</div>\[/code\]CSS:\[code\]div.container { width: 300px; height: 400px; border: solid 1px black; overflow: hidden; background: #efefef;}\[/code\]JS:\[code\]var myDiv = document.getElementById("myDiv");var pageWidth = parseInt(myDiv.style.width);\[/code\]I want to read css property and I can change value using js.
I have tried search with google, and my js code from link of google.
After I check the problem with safari's web inspector, there is problem in that I give sign for js code.Why is that wrong?
 
Back
Top