jQuery nextAll () method
Examples
Returning each <li> element with the class name "start" after all sibling elements:
$("li.start").nextAll().css({"color":"red","border":"2px solid red"});
});
result:
- ul (parent)
- li (sibling)
- li (sibling)
- li (sibling with class name "start")
- li (sibling)
- li (sibling)
- li (sibling)
try it"
Definition and Usage
nextAll () method returns all sibling elements after the selected element.
Sibling elements are elements that share the same parent element.
DOM tree: This method along siblings DOM element traversal forward.
Related methods:
- Next () - Returns after being a sibling element of the selected element
- nextUntil () - Returns all two siblings to each element of the given parameters after the
grammar
参数 | 描述 |
---|---|
filter | 可选。规定缩小搜索元素之后的同级元素范围的选择器表达式。 注意:如需返回多个同级元素,请使用逗号分隔每个表达式。 |
More examples
Narrow your search
How-to-peer search filter element after the element.
Return more than one sibling elements
How to use the filter parameter returns all sibling elements with a class name of "1", "2" and "3" <h2> element.
Select all sibling elements <p> element after the
How to select all the sibling elements <p> element later on.
All peer <p> element select <div> after
All peer <p> How to select elements of each <div> element later.