Hi,
In my script, i need to get width of an element in "ex" units (font width)
Is there any way to do this using JavaScript, jQuery ?
Hi,
In my script, i need to get width of an element in "ex" units (font width)
Is there any way to do this using JavaScript, jQuery ?
Not directly. jQuery uses the offsetWidth
and offsetHeight
properties, which only return integer values. If the exact width you're looking for is specified in the stylesheet, you can probably use element.css('width')
and get the intended result, but, otherwise, you'll have to either do some serious trickery to convert, or just deal with using pixels instead.