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

# copyToClipboard()

Copies text to the user’s clipboard.

## Syntax

```javascript
copyToClipboard(text, callback);
```

## Parameters

* `text` → text to copy
* `callback` → optional function after copying

## Output

```javascript
void
```

## Example

```javascript
copyToClipboard('INVITE-472901', text => {
  $('#copy-status').text(`Copied ${text}`);
});
```

## Key Takeaway

> `copyToClipboard()` is for copy buttons and invite codes.
