02.06.2013 Views

DOM Traversal Methods

DOM Traversal Methods

DOM Traversal Methods

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

.height()<br />

Gets the current computed height for the first element in the set of<br />

matched elements.<br />

Parameters<br />

None.<br />

.height()<br />

Return Value<br />

The height of the element, in pixels.<br />

[ 67 ]<br />

Chapter 4<br />

Description<br />

The difference between .css('height') and .height() is that the latter returns<br />

a unit-less pixel value (for example, 400) while the former returns a value with<br />

units intact (for example, 400px). The .height method is recommended when an<br />

element's height needs to be used in a mathematical calculation.<br />

.height(value)<br />

Sets the CSS height of each element in the set of matched elements.<br />

.height(value)<br />

Parameters<br />

•<br />

value: An integer representing the number of pixels, or an integer with an<br />

optional unit of measure appended<br />

Return Value<br />

The jQuery object, for chaining purposes.<br />

Description<br />

With .height('value'), unlike with .css('height','value'), the value can be<br />

either a string (number and unit) or a number. If only a number is provided for the<br />

value, jQuery assumes a pixel unit.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!