.nextUntil( [selector ] [, filter ] ) Returns: jQuery
Description: Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed.
-
version added: 1.4.nextUntil( [selector ] [, filter ] )
-
version added: 1.6.nextUntil( [element ] [, filter ] )
Given a selector expression that represents a set of DOM elements, the .nextUntil()
method searches through the successors of these elements in the DOM tree, stopping when it reaches an element matched by the method's argument. The new jQuery object that is returned contains all following siblings up to but not including the one matched by the .nextUntil()
argument.
If the selector is not matched or is not supplied, all following siblings will be selected; in these cases it selects the same elements as the .nextAll()
method does when no filter selector is provided.
As of jQuery 1.6, A DOM node or jQuery object, instead of a selector, may be passed to the .nextUntil()
method.
The method optionally accepts a selector expression for its second argument. If this argument is supplied, the elements will be filtered by testing whether they match it.
Example:
Find the siblings that follow <dt id="term-2"> up to the next <dt> and give them a red background color. Also, find <dd> siblings that follow <dt id="term-1"> up to <dt id="term-3"> and give them a green text color.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
|