开发者

how to select n-th td of a tr using jquery

开发者 https://www.devze.com 2023-04-01 00:18 出处:网络
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 ?using :nth-child() Selector

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 ?


using :nth-child() Selector

like

$("tr td:nth-child(2)")


the eq api should do this for you

$("table td").eq(n)


$('#id td:nth-child(3)');

Like so for the 3rd.

0

精彩评论

暂无评论...
验证码 换一张
取 消