首页 > 解决方案 > 过滤从 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

我需要做什么?

标签: jqueryhtml-table

解决方案


您可以使用 has 选择器

var filas = $("#table tr:has(td)");
filas.each(function(index){
               console.log( $(this).children(':nth-child(2)').html() );
           });

推荐阅读