表格单元格的jQuery选择器(第一行/最后一行/列除外) [英] JQuery selector for table cells except first/last row/column
本文介绍了表格单元格的jQuery选择器(第一行/最后一行/列除外)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有一种方法可以直接选择一个表的所有内部"表单元格(<td>
元素)(即,所有单元格,除了第一,最后一行和最后一列中的单元格外). jQuery选择器表达式?
is there a way to directly select all 'inner' table cells (<td>
elements) of a table (i.e. all cells except the ones in the first and last row and column) using a jquery selector expression?
推荐答案
您可以使用 :not()
与 :first-child
和
You can use :not()
with the :first-child
and :last-child
selectors, like this
$('table td:not(:first-child, :last-child)')
也要排除第一行/最后一行:
To exclude first/last rows as well:
$('table tr:not(:first-child, :last-child) td:not(:first-child, :last-child)')
这篇关于表格单元格的jQuery选择器(第一行/最后一行/列除外)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文