Is there a way to shorten these types of lines by using CSS selectors and jQuery?
$(element).parent('tr').parent('tbody').parent('table')
$(element).children('tbody').children('tr').children('td')
It is basically: "get me the direct parent/children if any"
I need 100% equal selectors.
UPDATE:
closest('table)
does not work: can return the element itself AND may find not direct parents
find('td')
does not work: as I need only the direct children; there might be plenty of them in the subtree below
You can use .closest() to find the first ancestor mathcing the given selector
In the below case use find() with child selector