What is a correct way to get the numerical value of an element width? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is a correct way to get the numerical value of an element width?

Assuming an element id is "myId", using document.getElementById("myId").style.width returns a string such as for example "100px". What is a correct way to have it numerically without using split("px") on the returned string? Thanks.

18th Mar 2017, 12:17 AM
Wabaki
2 Answers
+ 1
Thank you, that's what I was looking for!
18th Mar 2017, 8:14 AM
Wabaki