> For the complete documentation index, see [llms.txt](https://jscula.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jscula.gitbook.io/docs/traversal/.next.md).

# .next()

## **`$(selector).next()`**

Returns the **next sibling element**.

#### Example

```html
<div>
<div id="one"></div>
<div id="two"></div>
<div/>
```

```js
$('#one').next(); 
// returns <div id="two">
```

***

### Use cases

Use `.next()` to work with content immediately following an element:

* Show inline validation feedback next to an input.
* Update the next item in a step sequence.
* Read a label beside a control.

### More examples

Show the sibling error message after an invalid input:

```javascript
$('#email').next().text('Enter a valid email address.').addClass('visible');
```

Mark the next step as active:

```javascript
$('#current-step').next().addClass('active');
```
