instance method Element#getWidth
Element#getWidth() → Number
Returns the width of element
.
This method returns correct values on elements whose display is set to
none
either in an inline style rule or in an CSS stylesheet.
For performance reasons, if you need to query both width and height of
element
, you should consider using Element.getDimensions
instead.
Note that the value returned is a number only although it is expressed in pixels.
Examples
<div id="rectangle" style="font-size: 10px; width: 20em; height: 10em"></div>
Then:
$('rectangle').getWidth();
// -> 200
This method can be called either as an instance method or as a generic method. If calling as a generic, pass the instance in as the first argument.