> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://ajuda.greatsoftwares.com.br/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# How to add a COPY TEXT function inside GreatPages

Follow the step-by-step guide below to add a **COPY** function to a text element inside **GreatPages**.

1. Sign in to your account and open the page editor;

2. Using the icon bar on the left side of your screen, click the **"Paragraph"** element;

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/image_jw24vs.png)

3. Once the element is on the page, click to edit it and enter the text or number you want your visitor to copy. In the example below, we're using a PIX key;

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/image_rxglxc.png)

4. After that, click the **gear icon** in the top right corner of the screen;

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/settings_ephn21.png)

5. Next, click on **"Javascript & CSS"**;

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/onlyjavascript_14aeljh.png)

6. Click to **"Add"** a new code;

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/addcode_12nufh7.png)

7. Choose a name for your code, select the **"Functionality"** option, add all the code below into the text field, and save;

```
<script>
var id_elemento = '#e_0000000';
var elementos = document.querySelectorAll(id_elemento);
if(elementos){
    for (let index = 0; index < elementos.length; index++) {
        elementos[index].setAttribute('onclick','copyText(this)');

    }
}
window.copyText = function(element) {
  var range, selection, worked;

  if (document.body.createTextRange) {
    range = document.body.createTextRange();
    range.moveToElementText(element);
    range.select();
  } else if (window.getSelection) {
    selection = window.getSelection();
    range = document.createRange();
    range.selectNodeContents(element);
    selection.removeAllRanges();
    selection.addRange(range);
  }

  try {
    document.execCommand('copy');
    alert('O texto foi copiado');
  }
  catch (err) {
    alert('Não foi possível copiar o texto');
  }
};
</script>
```

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/image_19bf0lh.png)

8. The next step is to copy the ID of the text element to add it to the code. To do this, click the element and click on "Edit":

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/image_1e1viw4.png)

In the "Code" section, you'll find the element's ID/CSS; just click to **copy** it

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/image_17nkbfb.png)

9. Copy the ID and go back to the Javascript/CSS tab, then edit the code you added. The only change you need to make is to replace this part -> '#e\_0000000'

||| Don't add spaces or any other characters.

![](https://storage.crisp.chat/users/helpdesk/website/-/a/6/a/b/a6ab90d8350d6000/image_1ov2ecg.png)

12. After that, click on **"Add"**;

This way, all visitors who click this element will have it copied automatically.

Still have questions? Reach out to our team on Chat! We're always happy to help. :-)  