I am getting the width of element in integer rather than in fraction because my element width is 49.358 px
. But i am getting 50px
using
$('lichildren').width()
where liChildren
is my variable
please suggest me any alternate for this issue.
I am getting the width of element in integer rather than in fraction because my element width is 49.358 px
. But i am getting 50px
using
$('lichildren').width()
where liChildren
is my variable
please suggest me any alternate for this issue.
Reference Question Use the native Element.getBoundingClientRect
rather than the style of the element. It was introduced in IE4 and is supported by all browsers:
$("#lichildren")[0].getBoundingClientRect().width
See the following answer to a similar question:
Getting the actual, floating-point width of an element
The accepted answer starts by saying:
If you already have a reference to the DOM element, element.getBoundingClientRect will get you the values you want.