Get the immediately following sibling of each element in the set of matched elements.
// <h1>Title</h1><p>Text</p>
$('h1').next().css('color', 'red');
<h1>Title</h1>
<p style="color: red;">Text</p>
// <li>A</li><li class="selected">B</li>
$('li').next('.selected').addClass('highlight');
<li>A</li>
<li class="selected highlight">B</li>
| Parameter | Type | Description |
|---|---|---|
| selector | string | Optional. If specified, retrieves the next sibling only if it matches this selector. |
Returns: A new SR object.