jquery – 选择最后一个tr旁边

前端之家收集整理的这篇文章主要介绍了jquery – 选择最后一个tr旁边前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我想在表格中抓住最后一个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)
原文链接:https://www.f2er.com/jquery/176924.html

猜你在找的jQuery相关文章