开发者

How can I get/set the height of an hidden element by jquery?

How can I get/set the height of an hidden element by jquery?

<div id="test" styl开发者_运维技巧e="display:none">...</div>

$("#test").height() return 0

$("#test").height(30) return exception.


$("#test").ccs("height", "30px");

or

$("#test").height("30px");

It is returning 0 because it is hidden.


Yo should do (with quotes):

  $("#test").height('30') 

$("#test").height() returns 0 if you don't define a default width in an external css and if the element is hidden.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜