Getting Siblings That Come After Selected Objects

$("#title").next("p");   //finds the element with id="title" and selects   //the very next <p> element that is a sibling $("p:first").nextAll();   //selects the first <p> element that it finds and   //then selects all the <p> siblings to that element $("p:first").nextUntil("ul");   //selects the first <p> element that it finds and   //then selects all the siblings until it finds a <ul> element

The .next([selector]) method returns a jQuery object representing the next sibling of each element in the current set. If the optional selector is provided, the next sibling is added only if it matches the selector.

The .nextAll([selector]) method returns a jQuery object ...

Get jQuery and JavaScript Phrasebook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.