jQuery logo

There's a table in html page and you need to get the quantity of it's rows. It's easy to get it with jQuery.

HTML code of table:

 

<table id="idAttachmentsTable" border="0" cellSpacing="0" cellPadding="0">
    <TBODY>
<TR id=attachRow0>
<TD class=ms-vb><SPAN dir=ltr>1</TD>
<TD class=ms-propertysheet>2</TD></TR>
<TR id=attachRow1>
<TD class=ms-vb><SPAN dir=ltr>3</TD>
<TD class=ms-propertysheet>4</TD></TR>
</TBODY>
</table>

 

JS Code:

 

    $(document).ready(function(ctrlId) {
        var rowCount = function() {
            return ctrlId.length;
        };
        console.log(rowCount($('#idAttachmentsTable tbody tr')));
    });