How to copy to clipboard with Script block ?

Hi, I need create a function to copy into clipboard the value of a variable.

But is copying the ID of the block

Here is the JSCODE

// The value to be copied var valor = '{{code}}'; // Creates a temporary element to copy the value var tempInput = document.createElement('input'); tempInput.value = valor; document.body.appendChild(tempInput); // Select and copy the value tempInput.select(); document.execCommand('copy'); // Remove the temporary element document.body.removeChild(tempInput); // Displays the message "Copied!" alert('Copiado!');
image.png
image.png
image.png
Was this page helpful?