Reputation: 654
I want to have the width in Numbers( without Px ) of a Dynamic Width Element ( width: auto ), I tried it with clientWidth, parseInt, offsetWidth, but it always returned with a '0' or with NaN.
How can I have that numbers?
Thanks a lot in Advance.
Upvotes: 0
Views: 148
Reputation: 35572
in jquery
alert($("#mydiv").innerWidth().replace("px",""));
in javascript
alert (document.getElementById('mydiv').style.width.replace("px",""));
Upvotes: 1