Hi,
Assuming your table has the same number of tds in each tr.
You can try this approach:
First find the position of the selected td in its tr.
Then find the prev() or next() tr.
Then select the td with the same position in that tr.
Try this:
$('td').click(function(){
var trparent = $(this).parent('tr');
var position = $('td', $(this).parent('tr')).index(this);
$('td:eq('+ position +')', $(trparent).prev('tr')).css
('color','white');
$('td:eq('+ position +')', $(trparent).next('tr')).css
('color','green');
});
Paul
On Nov 18, 11:13 am, Jan jha...@gmail.com wrote:
Hi there,
I'm new to jQuery and was looking for a way to get a table cell above
or below the current one.
What I mean is a function like .prev() or .next() but those only help
me getting the cell to the left or to the right.