如何在Jquery中获取表的高度

时间:2012-03-20 04:58:34

标签: jquery html css html-table

如何在jQuery中获取html表的高度。例如,如果我们有以下代码,那么我们如何获得表的高度: -

<table>
<tr>
<td>

<div>Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here </div>

</td>

<td>

<div>Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here Some Text Here </div>

</td>
</tr>
</table>

3 个答案:

答案 0 :(得分:5)

$('table').height()甚至$('table').outerHeight()怎么样。

答案 1 :(得分:2)

也许this

var height = $('#abc').height();

答案 2 :(得分:1)

使用这样的表:

<table id="abc">
      ...
</table>

为了获得上表的高度,需要的jQuery是:

var height = $('#abc').height();