Home Ask Login Register

Developers Planet

Your answer is one click away!

user83847 February 2016

multiple :not jquery / ajax

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?


narainsagar February 2016

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


So, in your case would be:

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


$(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/

urvish February 2016

you can simply do this

:bind the same event multiple times.

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

Post Status

Asked in February 2016
Viewed 1,097 times
Voted 6
Answered 2 times


Leave an answer

Quote of the day: live life