jquery - 选择最后一个 tr 旁边的

标签 jquery

我想获取表中倒数第二个 TR。

$("#TableID tr:last")

获取最后一个,有什么方法可以在该之前获取 TR 吗?

最佳答案

当为 eq 指定负索引时,它从末尾开始倒数。

.eq( -index )

-index An integer indicating the position of the element, counting backwards from the last element in the set.

$('#TableID tr').eq(-2)

关于jquery - 选择最后一个 tr 旁边的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3560233/

相关文章:

javascript - 让角色在 Canvas 内跳跃

javascript - 当我交换表行时,无法在 JQuery 函数中交换数字

jquery - 如何设置窗口位置?

javascript - keypress() 上的 Jquery 键盘字符代码的完整列表

javascript - 为什么我的代码在间隔完成之前没有运行?

javascript - Highcharts:是否可以显示类似于饼图图例的旭日图例?

jquery - 当我单击 jQuery 中的单选按钮时,如何运行函数

PrettyPhoto 触发后,JQuery 滚动不起作用

php - 如何使用 jQuery 仅通过单击 "a"标签获取文本

javascript - 使用 jquery 捕获事件