【发布时间】:2025-12-25 09:10:11
【问题描述】:
我有 tr 类 firstrow 和 tr 类称为 addrows 。 addrows 类总是在 firstrow 类之后,我想计算每个 firstrow tr 之后的 addrow tr 的数量。在我的示例中,它应该是 1 和 6 。这是我的代码。
<table id="sdx-O_BAR_added" class="roomtypeadded">
<tbody>
<tr class="header">
</tr>
<tr class="header">
</tr>
<tr class="firstrow">
</tr>
<tr class="addrows">
</tr>
<tr class="header">
</tr>
<tr class="header">
</tr>
<tr class="firstrow">
</tr>
<tr class="addrows">
</tr>
<tr class="addrows">
</tr>
<tr class="addrows">
</tr>
<tr class="addrows">
</tr>
<tr class="addrows">
</tr>
<tr class="addrows">
</tr>
</tbody>
</table>
我不知道该怎么做,我尝试使用 jquery siblings() 和 next()。但不能这样做,请帮忙。 :(
【问题讨论】:
-
它只是您想要的实际数字,还是您想要返回匹配元素的集合?
-
yap 。我需要重新返回匹配的元素。谢谢
标签: php jquery zend-framework