jQuery parent of a parent
Posted
by Bloudermilk
on Stack Overflow
See other posts from Stack Overflow
or by Bloudermilk
Published on 2009-06-08T19:05:52Z
Indexed on
2010/03/26
8:03 UTC
Read the original article
Hit count: 428
JavaScript
|jQuery
Hello,
I am currently trying to find the parent of a parent of an element. I have a link being clicked that is in a <td>
, and I'd like to get the <tr>
object.
Why wont "$(this).parent().parent()" work? What will?
Thanks,
Brendan
Edit: It appears an error in my syntax was throwing the whole thing off. "$(this).parent().parent()" does in fact work, but I wound up going with $(this).closest('tr')" because it seems like the most efficient solution.
© Stack Overflow or respective owner