Well i have a function that modify the tbody on the fly.
So i need to use something like this in 1.7.1:
$("table#id").on('click', 'tr', callback);
Now i need to get out of this event trigger the first and the last td.
So i do something like:
$("table#id").on('click', 'td:not(:first, :last)', callback);
But this doesn’t work.
I tried with .live() too, and i don’t get any result.
Thanks!
:first and :last match the first and last element in the jQuery object. Since you’re using
on(), that selector will be evaluated in the context of a jQuery object containing a single element (the event target). Therefore, that element will never be matched, as it is both the first and last item in the set.Contrast :first-child and :last-child, which match the first and last element in the parent element. Using them should solve your problem: