The jQuery API .next() method allows you to select the next sibling of the element specified by the selector. It will find all next siblings if there are multiple matched elements to the selector. You then follow the .next() method with other methods for styling the sibling element.

For example


the code above will findeach the the <p> tags immediately following the <h2 class="subject-title"> tags in the following HTML and perform the css() method as stated:

<div id="title-box">
    <h2 class="subject-title">Albuquerque</h2>
    <p>This city is located is in the central part of ...</p>
    <p>Home of the University of New Mexico...</p>
<div id="title-box">
    <h2 class="subject-title">Carlsbad</h2>
    <p>This city is located is in the southeast corner...</p>
    <p>Famous for the Carlsbad Caverns National Park...</p>

The result