Sailing_12
asked on
Syntax to combine parent() and next() to traverse table rows
What is the syntax to use jQuery parent() and next() functions together to traverse table rows.
I have a table with an image in the first celll of all of the odd rows which I want to use as a trigger to expand the corresponding next row. So from the image element, I guess I want to traverse up two parents (td and tr) and then get the next tr in the table.
I have a table with an image in the first celll of all of the odd rows which I want to use as a trigger to expand the corresponding next row. So from the image element, I guess I want to traverse up two parents (td and tr) and then get the next tr in the table.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The only other suggestion I can think of would be:
$(this).parents("tr").next ()
(note the s on parents)
$(this).parents("tr").next
(note the s on parents)
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sailing_12,
Note, that the method parent is different than parents (with s). parent will only return the first ancestor of an element, but parents will return all ancestor without the root element.
Note, that the method parent is different than parents (with s). parent will only return the first ancestor of an element, but parents will return all ancestor without the root element.
ASKER
Great thanks.
ASKER
Thanks.
ASKER