Currently I am using
$('table').children('tfoot').children('tr').children('td');
to get the only td in the tfoot.
I dont like using .children()
3 times,
Is there a better way?
var table = this;
$(table).children('tfoot').children('tr').children('td');
as this is inside a jquery plugin.
$('table > tfoot > tr > td')
children()
searches in immediate children, so to replicate this, I used the direct descendant selector (>
).
From your update, you could do...
$(table).find(' > tfoot > tr > td')
or you could replace table
with this
.
I'm glad you are thinking of the children.
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