jquery - 过滤从 X 行开始的表格单元格或行
问题描述
我需要从 X 行开始的表格中选择一个单元格。
我有这个:
var filas = $("#table tr");
filas.each(function(index){
console.log( $(this).children(':nth-child(2)').html() );
});
它打印在我的控制台中的每一行,但我正在过滤的那一行,包括标题......
例如:
Table Header
1
2
4
5
6
我只想得到
1
2
4
5
6
我需要做什么?
解决方案
您可以使用 has 选择器
var filas = $("#table tr:has(td)");
filas.each(function(index){
console.log( $(this).children(':nth-child(2)').html() );
});
推荐阅读
- c# - 使用 HttpWebRequest 的 ADFS 身份验证
- apache-kafka - Kafka - 根据预定时间将消息移动到队列前面
- azure - Azure IoT 中心 - “订阅”代码不起作用:“连接被拒绝”
- sql - postgresql - 按数字分组并返回最大值
- iis - 为什么 IIS CORS 模块“访问控制允许来源”似乎被缓存?
- jmeter - JMeter 如果控制器不工作
- javascript - 与外部 react.js 捆绑不起作用 - 可能缺少一些全局变量?
- java - 无法从此列表中找到要调用的 maven() 方法:
- sql - 将数据加载到 PDW 上的临时表中
- python - 跟随抓取的链接