jQuery - Getting the second level parent of an element jQuery - Getting the second level parent of an element jquery jquery

jQuery - Getting the second level parent of an element


For selecting a second parent

parents(':eq(1)')

looks smoother than

parent().parent()

Also, you might find that

closest('ul')

fits the job better.


try:

$(this).parent().parent().find('.thingtofind').text();


parents() returns a list, so this works:

$(this).parents()[1];