Articles on: Page Editor

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 "Parágrafo" element;



  1. 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;



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



  1. Next, click on "Javascript & CSS";



  1. Click to "Adicionar" a new code;



  1. Choose a name for your code, select the "Funcionamento" 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>



  1. 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 "Editar":



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



  1. 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.



  1. After that, click on "Salvar";


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.

Updated on: 08/01/2026

Was this article helpful?

Share your feedback

Cancel

Thank you!