[jQuery] Re: Get the below and above

2009-11-18 Thread Jan
Thank you both, it works :)

[jQuery] Re: Get the below and above

2009-11-18 Thread Dave Methvin
If the table is really big it might be better to use event delegation: $('table').click(function(e){ var $td = $(e.target).closest('td'), $tr = $td.parent(), pos = $tr.children().index($td), $up = $tr.prev().children().eq(pos), $dn = $tr.next().children().eq(pos); $up.c

[jQuery] Re: Get the below and above

2009-11-18 Thread Paul Mills
Hi, Assuming your table has the same number of s in each . You can try this approach: First find the position of the selected in its . Then find the prev() or next() . Then select the with the same position in that . Try this: $('td').click(function(){ var trparent = $(this).parent('tr')