I am trying to retrieve the parent of an <a> element's parent (grandparent?). I want to find that grandparent, then find a <b> tag in that element, then store that text as a variable to publish elsewhere on the page. I've been trying to use the parent() function but without success.
Here's the code I tried:
$('.mixPlayCell a').click( function() {
var title = $(this).parent().get(0).parent().get(0).text();
alert(title);
});
For selecting a second parent
parents(':eq(1)')
looks smoother than
parent().parent()
Also, you might find that
closest('ul')
fits the job better.