Forum Discussion
Copy and Paste Multiple Variables?
Hey Daniel,
I'm sure Zsolt will see this and respond eventually. In the meantime, I'm working my way around JavaScript too. I was able to get it to capture multiple variables and allow me to copy them to the clipboard. Unfortunately, the formatting is a problem as you can see below. But, hey, some progress to be happy about!
I'm sure Zolt will have a much more elegant solution! :)
Richard
var player = GetPlayer();
var text1 = player.GetVar("MyIntro");
var text2 = player.GetVar("MyWhy");
var text3 = player.GetVar("MyChallenge");
var summary = text1 + ' ' + text2 + ' '+ text3;
player.SetVar("summary",summary);
var text = player.GetVar("summary");
copyFunction (text);
function copyFunction(tt) {
const copyText = tt;
const textArea = document.createElement('textarea');
textArea.textContent = copyText;
document.body.append(textArea);
textArea.select();
document.execCommand("copy");
alert("Copied to clipboard!");
}
Related Content
- 12 months ago
- 12 months ago
- 12 months ago
- 12 months ago