How to process element excluding the first and last one. I have a table with a given number of rows. I want to trigger the rows on a click event but should not process the click if first or last row is clicked. How can I implement this?
+5
A:
How about:
$('tr:not(:first, :last)').click(function() {
// ...
})
?
Roatin Marth
2009-09-17 15:08:45
This isn't a valid CSS selector, :not can only contain a simple selector. It seems to work in jQuery at the moment, but `tr:not(:first):not(:last)` would be the reliable way to do it.
bobince
2009-09-17 16:11:24
@bobince: since 1.3 jQuery can take complex selectors in :not psuedo expressions (i.e., comma separated selectors are valid): http://docs.jquery.com/Selectors/not
Roatin Marth
2009-09-18 13:27:56