I am trying to select only 2 and 3 columns of the "services" table.
For instance,
$('table[class="services"] tr td:nth-child(3)')
selects the third column, is there a way to select both the second and third columns with one selector?
$('table[class="services"] tr td:nth-child(3), table[class="services"] tr td:nth-child(2)')
You can break it down to avoid repeating the first part of the selector:
$('table.services tr td').filter(':nth-child(2), :nth-child(3)')
Also note that this table.servicesis the βrightβ way to select by class in CSS!
table.services
You can do:
$('table.services tr td:nth-child(2), table.services tr td:nth-child(3)')
OR ... you can do it like this:
$('table.services tr td:nth-child(2):nth-child(3)')
Also useful for a range of columns, such as columns 4 through 7 (if necessary):
$('table.services tr td:nth-child(4):nth-child(7)')