Hi everyone, good afternoon.
I'm running a chat here and saving the bot's response in the response variable
Then I show a button on the screen that runs the following script
var resposta = {{resposta}};
function copyToClipboard() {
var textToCopy = resposta;
var tempInput = document.createElement("textarea");
tempInput.value = textToCopy;
document.body.appendChild(tempInput);
tempInput.select();
document.execCommand("copy");
document.body.removeChild(tempInput);
alert(resposta);
}
console.log(resposta);
However, instead of saving the content of the response variable to the work area, it saves all the code to the work area.
What am I doing wrong?
Add a reply
Sign up and join the conversation on Discord