Element
- absolutize
- addClassName
- addMethods
- adjacent
- ancestors
- childElements
- classNames
- cleanWhitespace
- clonePosition
- cumulativeOffset
- cumulativeScrollOffset
- descendantOf
- descendants
- down
- empty
- extend
- fire
- firstDescendant
- getDimensions
- getElementsByClassName
- getElementsBySelector
- getHeight
- getOffsetParent
- getStyle
- getWidth
- hasClassName
- hide
- identify
- immediateDescendants
- insert
- inspect
- makeClipping
- makePositioned
- match
- next
- nextSiblings
- observe
- positionedOffset
- previous
- previousSiblings
- readAttribute
- recursivelyCollect
- relativize
- remove
- removeClassName
- replace
- scrollTo
- select
- setOpacity
- setStyle
- show
- siblings
- stopObserving
- toggle
- toggleClassName
- undoClipping
- undoPositioned
- up
- update
- viewportOffset
- visible
- wrap
- writeAttribute
getWidth
getWidth(element) -> Number
Finds and returns the computed 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>
$('rectangle').getWidth();
// -> 200