How do I get to the parent table tag from the td
I am currently in?
I tried .parents('table')
but that selects all tables outside the td
, I just need the current one
The parent() is an inbuilt method in jQuery which is used to find the parent element related to the selected element. This parent() method in jQuery traverse a single level up the selected element and return that element. Here selector is the selected elements whose parent need to find.
jQuery(". dname"). find("tr td:eq(1)"). val();
You need to use closest()
function:
$('td').closest('table');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With