getWidth :: Element

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 getDimensions() instead.

 

Examples

 

<div id="rectangle" style="font-size: 10px; width: 20em; height: 10em"></div>

 

$('rectangle').getWidth();

// -> 200

 

 

Note

 

Note that the value returned is a number only although it is expressed in pixels.


Prototype API 1.5.0 - prototypejs.org