skaterdav85 Posted May 7, 2010 Report Share Posted May 7, 2010 So I have a table with several rows generated dynamically like this: <tr> <td>text 2</td> <td><img src='#' /></td></tr> When the image is clicked, it runs a function and performs a fade on the entire row like this: jQuery(this).parent().parent().fadeTo(700, 0.3); I was wondering if there is a more efficient way of getting the <tr> element through the parent/child relationship. This worked, but i dont like how i used parent() twice to go up 2 levels. Link to comment Share on other sites More sharing options...
chibineku Posted May 8, 2010 Report Share Posted May 8, 2010 You can try using jQuery(this).prev('tr').fadeTo(700, 0.3); Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now