How to choose elements but exclude first and last

2020-08-21 02:31发布

问题:

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?

回答1:

How about:

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

?



标签: jquery