Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify multiple columns with nth-child()

I'm using nth-child in my jquery selector to identify columns to modify. I have 5 columns (1-5) and I want to modify only 2,3, and 4. Is there a way to do this with nth-child? Something like:

$('#example tbody tr td:nth-child(2||3||4)')

I have tried several combinations but nothing seems to work. Im pretty new to jQuery selectors any help you could throw at me would be greatly appreciated.

Regards, Joe Chin

like image 242
JoeChin Avatar asked Sep 06 '10 16:09

JoeChin


1 Answers

You could use .nextUntil() like this:

$('#example tbody tr td:nth-child(1)').nextUntil(':nth-child(5)');​​​​​​​​​​​​​​​​​​​​​​​
like image 96
user113716 Avatar answered Jan 01 '23 07:01

user113716