使用nth-child()指定多个列

Joe*_*hin 5 jquery css-selectors

我在我的jquery选择器中使用nth-child来识别要修改的列.我有5列(1-5),我只想修改2,3和4.有没有办法用nth-child做到这一点?就像是:

$('#example tbody tr td:nth-child(2||3||4)')
Run Code Online (Sandbox Code Playgroud)

我尝试了几种组合,但似乎没有任何效果.我是jQuery选择器的新手任何你可以扔给我的帮助将不胜感激.

此致,Joe Chin

use*_*716 7

你可以.nextUntil()像这样使用:

$('#example tbody tr td:nth-child(1)').nextUntil(':nth-child(5)');???????????????????????
Run Code Online (Sandbox Code Playgroud)


ken*_*ytm 5

$('#example tbody tr td:not(:last-child, :first-child)')
Run Code Online (Sandbox Code Playgroud)