jquery .children() returning wrong size
- by i need help
Hi guys, I just found the children size not consistent.
Below attach full code with alert, for easy reference.
Is the way I get the data wrong?
<body>
<table width="100" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="30" valign="top"><strong>Header Title</strong></td>
</tr>
<tr>
<td height="32" valign="top">Date : <strong>01/01/2010 </strong> <br><div><b></b></div><span></span></td>
</tr>
</table>
</body>
$("td").each(function() {
alert($(this).children().size());
});
//first td showing 1 direct children- <strong>
//second td showing 4 direct children- <strong> <br> <div> <span>
-----
$("tr").each(function() {
alert($(this).children().size());
});
//first tr showing 1 direct children - <td>
//second tr showing 1 direct children - <td>
-----
$("table").each(function() {
alert($(this).children().size());
});
// ERROR
// this table showing 1 direct children only.... something WRONG.
// I thought there are 2 <tr> inside this table?