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.
精彩评论