[jQuery] Re: text of first sibling of a parent...How do I get it

2009-06-04 Thread jake dimano
nt(). >> > parents() means ancestor and table is ancestor of TDs >> > >> > See: http://docs.jquery.com/Traversing >> > Maurício >> > - >> > >> > -Mensag

[jQuery] Re: text of first sibling of a parent...How do I get it

2009-06-03 Thread Gustavo Salomé
ancestor and table is ancestor of TDs > > > > See: http://docs.jquery.com/Traversing > > Maurício > > ----------------------------------------- > > > > -Mensagem Original- > > De: Ricardo > > Para: jQuery (English) >

[jQuery] Re: text of first sibling of a parent...How do I get it

2009-06-03 Thread jake dimano
I've used parents() not parent(). > parents() means ancestor and table is ancestor of TDs > > See: http://docs.jquery.com/Traversing > Maurício > - > > -----Mensagem Original- > De: Ricardo > Para: jQuery (En

[jQuery] Re: text of first sibling of a parent...How do I get it

2009-06-03 Thread Mauricio (Maujor) Samy Silva
nviada em: quarta-feira, 3 de junho de 2009 15:15 Assunto: [jQuery] Re: text of first sibling of a parent...How do I get it There is no reason why you shouldn't get this working with one of the examples provided. For the nesting issue, filter with :first: $('#knowndiv').

[jQuery] Re: text of first sibling of a parent...How do I get it

2009-06-03 Thread waseem sabjee
ensure that the script src of jquery is correct On Wed, Jun 3, 2009 at 8:15 PM, Ricardo wrote: > > There is no reason why you shouldn't get this working with one of the > examples provided. For the nesting issue, filter with :first: > > $('#knowndiv').parents('tr:first').children('td:first').tex

[jQuery] Re: text of first sibling of a parent...How do I get it

2009-06-03 Thread Ricardo
There is no reason why you shouldn't get this working with one of the examples provided. For the nesting issue, filter with :first: $('#knowndiv').parents('tr:first').children('td:first').text(); parents(xx:first) is similar to closest(xx), only the latter will also try to match the element itse

[jQuery] Re: text of first sibling of a parent...How do I get it

2009-06-03 Thread jake dimano
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 wrote: > > The problem with parents() in the example given is that if your page > structure is more compl

[jQuery] Re: text of first sibling of a parent...How do I get it

2009-06-03 Thread jake dimano
Yes, that is the first thing I did, to no avail. I think all I am left with just trudging through this with pure javascript. jake On Wed, Jun 3, 2009 at 11:20 AM, BigAB wrote: > > have you tried > var myText = $('#knowndiv').parents('tr').find('td:first').text(); > alert(myText); > > The TR is

[jQuery] Re: text of first sibling of a parent...How do I get it

2009-06-03 Thread mkmanning
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: $('

[jQuery] Re: text of first sibling of a parent...How do I get it

2009-06-03 Thread BigAB
have you tried var myText = $('#knowndiv').parents('tr').find('td:first').text(); alert(myText); The TR is really the parent of the TDs, not the table. On Jun 3, 7:33 am, jake dimano wrote: > Mauricio, your code basically works fine on a simple test page.  But > there is something about my set-

[jQuery] Re: text of first sibling of a parent...How do I get it

2009-06-03 Thread jake dimano
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, t

[jQuery] Re: text of first sibling of a parent...How do I get it

2009-06-02 Thread Mauricio (Maujor) Samy Silva
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

[jQuery] Re: text of first sibling of a parent...How do I get it

2009-06-02 Thread waseem sabjee
first lets give an ID to your table now heres your script. var obj = $("mytable"); var rows = $("tr"): // according to this we going to find text in the first td of the first tr rows.each(function(i) { var columns = rows.eq(i); alert(columns.eq(0).text()); }); the script above should give