How can I select nth < td >
of a < tr >
using jquery. Say, I want to select 3rd < td >
. I have id for every tr. How can we achieve this ?
jQuery(". dname"). find("tr td:eq(1)"). val();
jQuery :nth-of-type() SelectorThe :nth-of-type(n) selector selects all elements that are the nth child, of a particular type, of their parent. Tip: Use the :nth-child() selector to select all elements that are the nth child, regardless of type, of their parent.
jQuery :nth-child() Selector The :nth-child(n) selector selects all elements that are the nth child, regardless of type, of their parent. Tip: Use the :nth-of-type() selector to select all elements that are the nth child, of a particular type, of their parent.
$(this). closest('tr'). children('td:eq(0)'). text();
using :nth-child() Selector
like
$("tr td:nth-child(2)")
the eq api should do this for you
$("table td").eq(n)
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