How to select next n hidden elements that have class "foo" using jQuery?
+2
A:
$(this).nextAll().filter('.foo:hidden:lt('+n+')');
The :lt() selector selects the next n elements, the :hidden selector hidden inputs.
Boldewyn
2010-03-25 11:23:57
Can you add `:hidden` to pick hidden inputs (as per OP's request)
alex
2010-03-25 11:29:44
+1 Fastest fingers first.
amelvin
2010-03-25 11:40:15
+2
A:
Boldewyn's answer works, but filter is unnecessary. This also selects only hidden elements:
$(this).nextAll('.foo:hidden:lt('+n+')')
Tatu Ulmanen
2010-03-25 11:30:42