[jQuery] tbody:first-child & thead

[jQuery] tbody:first-child & thead

Hi all,<div>
</div><div>I have a code that counts the number of rows in a table...</div><div>
</div><div>the table looks like:</div><div>
</div><div><table id="myTable"></div><div>  <thead></div>
<div>   ...</div><div>   </thead></div><div>
</div><div>   <tbody></div><div>        <tr></div><div>         ....</div><div>        </tr></div><div>  </tbody></div><div></table></div>
<div>
</div><div>
</div><div>and my jquery looks like:</div><div>
</div><div>$("#myTable  tbody:first-child  tr").length;</div><div>
</div><div>strange enough.... that always returns 0.</div><div>but if i remove the thead from the table... then it will return the correct number of rows..</div>
<div>
</div><div>or alternatively, i can keep the thead, but use the following instead:</div><div>
</div><div>$("#myTable  tbody  tr").length;</div><div>
</div><div>i.e. without specifying first-child.</div>
<div>
</div><div>Can anyone explain this behaviour?</div><div>
</div><div>
</div><div>
</div><div>THanks a lot!</div><div>
</div><div><br clear="all">
--
Best regards,
WiB
</div>