1

I currently have:

$(document).on('click','#audits-lines-grid table tbody tr td:not(td:nth-child(9n))',function(){(...)

I need to add a :not(first-child) as well.

I've tried several syntaxes, including

$(document).on('click','#audits-lines-grid table tbody tr td:not(td:nth-child(9n)):not(first-child)',function(){

but it doesn't work, any idea how to get this right?

user83847
  • 29
  • 3
  • Possible duplicate of [jQuery - multiple :not selector](http://stackoverflow.com/questions/7144976/jquery-multiple-not-selector) – GreyRoofPigeon Feb 08 '16 at 14:27
  • This is `:not(:first-child)` – A. Wolff Feb 08 '16 at 14:27
  • And if you don't want the first child, nor the 9th and there is no more than 16 children by row, you could use `td:not(:nth-child(8n + 1))` – A. Wolff Feb 08 '16 at 14:34
  • tried $(document).on('click','#audits-lines-grid table tbody tr td:not(td:nth-child(9n)), :not(:first-child)' it doesn't work ... $(document).on('click','#audits-lines-grid table tbody tr td:not(td:nth-child(9n)), #audits-lines-grid table tbody tr td:not(:first-child)' doesnt work either – user83847 Feb 08 '16 at 14:37
  • td:not(:nth-child(8n + 1)), that one work, thanks – user83847 Feb 08 '16 at 14:48

1 Answers1

1

The :not selector can take multiple CSS selectors as arguments ( http://api.jquery.com/not-selector ). E.g.

$('div:not(.a,.b)').empty()

So, in your case would be:

td:not(:nth-child(9n), :first-child)

Final:

$(document).on('click','#audits-lines-grid table tbody tr td:not(:nth-child(9n), :first-child)',function(){(...)

Here is the demo jsfiddle as well: http://jsfiddle.net/HFfcP/

narainsagar
  • 1,079
  • 2
  • 13
  • 29