选择下一个具有类foo的元素

时间:2010-03-25 11:19:07

标签: jquery

如何使用jQuery选择下一个具有类“foo”的隐藏元素?

3 个答案:

答案 0 :(得分:3)

Boldewyn的回答有效,但filter是不必要的。这也只选择隐藏的元素:

$(this).nextAll('.foo:hidden:lt('+n+')')

答案 1 :(得分:2)

使用nextAll()filter()

$(this).nextAll().filter('.foo:hidden:lt('+n+')');

:lt()选择器会选择下一个n元素,:hidden选择器隐藏输入。

答案 2 :(得分:0)

$(this).nextAll('.foo:hidden').filter(':lt('+n+')')
相关问题