jQuery element + next Selector
Example
Select the element adjacent to each
the one immediately after the ... element
element:
$("div + p")
Try it »
Definition and Usage
The ("element + next") selector selects the "next" element following the specified "element". The "next" element must be placed immediately to the right of the specified "element".
Example: if an
element has two
elements to its right, the syntax is as follows:
- $("div + p") - Only the first
element is selected, because it is
the next element of theelement (the other element is ignored)
Example: if an
element and
If there is one ... element to the right
elements to its right, the syntax is as follows:
- $("div + p") - will not be selected
the element, because
the next element of the ... element isElement
**Note:** The two specified elements share the same parent element.
Syntax
("
element
next
")
| Parameters | Description |
|---|---|
| element | Required. Any valid jQuery selector. |
| next | Required. Specifies the element, which must be a element sibling of the next . |
jQuery selector