> For the complete documentation index, see [llms.txt](https://help.blings.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.blings.io/role-guides/creator/studio/custom-elements-advance/copy-text-to-clipboard.md).

# Copy text to clipboard

Copy static text

```jsx
(data, liveData, event, element, player) => {
  const text = "TEXT TO COPY";
  navigator.clipboard.writeText(text); 
}
```

Copy text coming from live control

```jsx
(data, liveData, event, element, player) => {
  const text = liveData.promoCode;
  navigator.clipboard.writeText(text); 
}
```

Copy text coming from per video data

```jsx
(data, liveData, event, element, player) => {
  const text = data.promoCode;
  navigator.clipboard.writeText(text); 
}
```

**Optional** - add alert after the copy

```tsx
navigator.clipboard
      .writeText(text)
      .then(() => {
        alert("successfully copied");
      })
      .catch(() => {
        alert("something went wrong");
      });
```

Or open a dynamic scene with thank you as another connector

Copy the code and then open a link immediately:

```jsx
(data, liveData, event, element, player) => {
  const text = CODE_TO_COPY

  navigator.clipboard
    .writeText(text)
    .then(() => {
      setTimeout(() => {
        window.open(LINK)
      }, 100)
    })
    .catch(() => {
      // alert("something went wrong");
    });

}
```
