> 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/.prevuntil.md).

# .prevUntil()

`.prevUntil()` gets previous sibling elements until it reaches a target.

## Syntax

```javascript
element.prevUntil(selector);
element.prevUntil(node);
```

## Parameters

* `selector` → selector where selection should stop
* `node` → DOM node where selection should stop

## Output

```javascript
NodeList | HTMLCollection | null
```

## Example

```javascript
$('.step.current')
  .prevUntil('.step.start')
  .addClass('before-current');
```

## Key Takeaway

> `.prevUntil()` collects previous siblings before a stopping point.
