Jquery – How to choose elements but exclude first and last elements


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?

Best Solution

How about:

$('tr:not(:first, :last)').click(function() {
    // ...