I must say, I have not tried "closest()" and "prevAll()". I'll give it another go with your suggestions before I throw in the towel. Thanks. jake
On Wed, Jun 3, 2009 at 11:22 AM, mkmanning <michaell...@gmail.com> wrote: > > The problem with parents() in the example given is that if your page > structure is more complex, and has nested tables for example, then > parents() will return all parent tables. Likewise if there are tr's > preceding the tr in your example. Here's a couple ways to get the text > you're asking for: > > $('#knowndiv').closest('tr').find('td:first').text(); > > $('#knowndiv').parent().prevAll(':last').text(); > > HTH :) > > On Jun 3, 6:33 am, jake dimano <jakedim...@gmail.com> wrote: >> Mauricio, your code basically works fine on a simple test page. But >> there is something about my set-up that makes the bit about >> ".parents('table')" fail. My page still has the same exact element >> structure with 2 differences; there are 52 "tr"s in the table; also, >> all the elements (tables, trs, tds, divs...what have you,) are all >> full of styles, attributes, and onclick events to a fairly large >> extent. >> >> Other variations and combination of jQuery functions fail as well in >> getting the parent of this div in my page. >> >> I guess I'll just keep on truckin'. >> jake >> >> On Tue, Jun 2, 2009 at 3:52 PM, Mauricio (Maujor) Samy Silva >> >> <css.mau...@gmail.com> wrote: >> > var myText = $('#knowndiv').parents('table').find('td:first').text(); >> > alert(myText); >> >> > Maurício >> >> > -----Mensagem Original----- >> > De: con-man-jake >> > Para: jQuery (English) >> > Enviada em: terça-feira, 2 de junho de 2009 16:38 >> > Assunto: [jQuery] text of first sibling of a parent...How do I get it >> >> > Still a newbie. >> > I have this: >> >> > <table> >> > <tr> >> >> > <td> >> > text I want to get >> > </td> >> >> > <td> >> > </td> >> >> > <td> >> > <div id="knowndiv"></div> >> > </td> >> >> > <tr> >> > </table> >> >> > If I have the div with id of "knowndiv" as an object (call it "obj"), >> > How do I get the text inside the first <td>? >