I whipped up a demo.
http://www.commadot.com/jquery/nestedTables.php

In the code comments is an "each" version that does the same thing.

Glen

On 10/25/07, hans <[EMAIL PROTECTED]> wrote:
>
>
> Hello,
>
> I am trying to loop through all rows of a table that has a table
> inside. I expected jquery to only loop through the tr's of the
> testtable but it loops through the inner one as well and even
> considers the whole inner table a tr. Am i doing something wrong or is
> there a better way to do this?
>
> thanks,
> Hans
>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
> www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml";>
>         <head>
>                 <script language="javascript" type="text/javascript"
> src="C:/
> Multivius.net/IIS/www/lib/jquery/jquery.js"></script>
>                 <script language='javascript'>
>                         $(document).ready(function(){
>                                 $("#testtable tr").each(function(t){
>                                         alert(this.firstChild.innerHTML)
>                                 });
>                         });
>                 </script>
>         </head>
>         <body>
>                 <table id='testtable'>
>                         <tr><td>a</td></tr>
>                         <tr><td>b</td></tr>
>                         <tr><td><table ID="inner_table"><tr><td>dont loop
> me please</td></
> tr></table></td></tr>
>                         <tr><td>c</td></tr>
>                         <tr><td>d</td></tr>
>                 </table>
>         </body>
> </html>
>
>

Reply via email to