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

# swapElements

`swapElements()` swaps the position of two elements.

#### Syntax

```js
swapElements(nodeA, nodeB);
```

#### Parameters

* `nodeA` → first DOM element
* `nodeB` → second DOM element

#### Output

```js
void
```

#### Example

```js
swapElements($('#first-card'), $('#second-card'));
```

{% hint style="info" %}
Use `swapElements()` when two elements need to trade places.
{% endhint %}
