get height of dom element after using get(index)

时间:2015-06-15 14:51:52

标签: jquery height

I use the following (not working code):

var height = $("#rows").children().get(index).height(); 

The thing is that .get(index) returns the DOM element. So after that the height() method does not exist.

How can I work around this problem?

1 个答案:

答案 0 :(得分:2)

use eq()

var height = $("#rows").children().eq(index).height();

or

var height = $("#rows").children().get(index).clientHeight;

NOTE: get() will be converted to javascript object so there is no height() method in javascript