Forum Discussion
BrettSchlagel-e
10 years agoCommunity Member
Copy Text Variable to Clipboard
I need some help.
I need users to be able to click a button to copy a text variable to their clipboard, which can then be pasted in a word doc. This doesn't necessarily have to be done through a ...
BrettSchlagel-e
10 years agoCommunity Member
I'm definitely not super familiar with JS, I've worked with it here and there with success but I'm still having troubles. What you found looks like it would work, I found this earlier and attempted it with no success, but that could purely be from what I wrote, as I am a noob when it comes to JS. Here's the code I tried:
var player = GetPlayer();
var text= player.GetVar("copytext");
function copyToClipboard(text){
window.prompt("Copy to clipboard: Ctrl+C, Enter", text);
Is that right? Close? Missing something? When my button (with the execute js trigger when clicked trigger) is clicked it does nothing.
Thanks for the help!