Yes, that definitely works, and it's the preferred method if you have nested tables.

--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Aug 20, 2008, at 5:51 PM, ak732 wrote:


If I have a table:

 <table>
    <tbody>
        <tr><td><span></span></td>/*many more cells here*/</tr>
        <tr><td><span></span></td>/*many more cells here*/</tr>
        // many more rows here...
     <tbody>
 </table>

And I'm handed a reference to a <span> inside one of the table cells,
what's the quickest method to obtain the row that contains the span?

Is this as fast as it gets?

  $(theSpan).parents('tr:first');

Does that even work?  Does ":first" work when climbing upwards through
the ancestry?

Thanks,
Andy

Reply via email to