How to get the height of table in Jquery

23,297

Solution 1

What about $('table').height() or even $('table').outerHeight().

Solution 2

Maybe this?

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

Solution 3

With a table like this :

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

The jQuery needed in order to get the height of the above table is :

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

Share:
23,297
John Preston
Author by

John Preston

Updated on January 03, 2020

Comments

  • John Preston
    John Preston over 4 years

    How can we get the height of the html table in jQuery. For example if we have the following code then how can we get the height of the table:-

    <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>
    
  • John Preston
    John Preston about 12 years
    How to store this in variable if the table has id="abc"
  • neoascetic
    neoascetic about 12 years
    @JohnPreston Why you not learn jQuery selectors syntax first?