[英]JQuery: How do I select the nth inputs in each row of a table?
I have a table with n columns, and n-2 inputs in each column. 我有一个包含n列的表,每列有n-2个输入。 I want to iterate over a single column of inputs, but can't figure out how to select them. 我想迭代一列输入,但无法弄清楚如何选择它们。
Use the nth-child()
selector . 使用nth-child()
选择器 。 For example, to get the third column of inputs: 例如,要获得第三列输入:
$('#table-id td:nth-child(3) input')
Remember that, in accordance with the CSS spec, nth-child()
is 1-indexed. 请记住,根据CSS规范, nth-child()
是1索引的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.