English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The jQuery nextUntil() method returns all sibling elements after the selector and stop.
Sibling elements must have the same parent element.
If both parameters are omitted, this method will return all next sibling elements, which is equivalent tonextAll()The method is the same.
$(selector).nextUntil(stop, selectorExpression)
Return sibling elements with id="div-1"s next sibling elements:
$(document).ready(function(){ $("#div-1").nextUntil().css("background", "mediumpurple"); });Test to see‹/›
Return all following sibling elements after<dt id="term-2">sibling elements, until the next<dt>:
$(document).ready(function(){ $("#term-2").nextUntil("dt").css("background-color", "coral"); });Test to see‹/›
Parameter | Description |
---|---|
stop | (Optional) Selector expression, element, or jQuery object indicating where to stop searching for the next matching sibling element |
selectorExpression | (Optional) Selector expression, element, or jQuery object to match the element Note:To return multiple siblings, separate each expression with a comma |