Feel The Noise
Feel The Noise

Reputation: 654

Get Number of a Dynamic Width Element

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

Answers (1)

Rab
Rab

Reputation: 35572

in jquery

 alert($("#mydiv").innerWidth().replace("px",""));

in javascript

alert (document.getElementById('mydiv').style.width.replace("px",""));

Upvotes: 1

Related Questions