如何选择元素,但排除第一个和最后一个元素 [英] How to choose elements but exclude first and last elements

查看:70
本文介绍了如何选择元素,但排除第一个和最后一个元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何处理除第一个和最后一个元素之外的元素. 我有给定行数的表.我想在单击事件上触发行,但是如果单击第一行或最后一行,则不应处理该单击. 我该如何实施?

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?

推荐答案

怎么样:

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

?

这篇关于如何选择元素,但排除第一个和最后一个元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆