Forum Discussion
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 text variable, but is the only way I've come to think this will work.
In the past I used a text entry field that when published allows users to copy and paste the text by highlighting and right clicking as you normally would. I've been asked to eliminate that route and only use a one-click copy to clipboard button.
I was able to get this to work using JavaScript, however, this only worked in IE and I desperately need it to work in FireFox. I used the method below from another post to get it to work in IE:
I've sifted through post after post and haven't found anything that will work for this situation. If at all possible, this would be great if this worked with HTML5 as well.
Any help would be greatly appreciated. Thanks!
26 Replies
- CrystalKlarich-Community Member
Hi all,
I'm piggy backing off Zsolt's awesome code. I needed to copy multiple variables and static text, so I modified Zsolt's code and created a tutorial here: https://www.klarichdesigns.com/2021/10/28/sl-clipboard/. JavaScript always looks so intimidating, so hopefully this helps anybody new.
Enjoy!
- martinyeamanCommunity Member
Hi, I'm trying to insert a storyline scene into rise 360. It uses a data text insert to allow readers to takes notes as they go through sections of a course. I would like them to simply click a "copy to clipboard" button to have the notes in the data text box. When i insert this into Rise it comes up with "null" Images attached below.
Is it not possible to do this within Rise?- BeccaLevanCommunity Member
Welcome to E-Learning Heroes, Martin!
While your question is a better fit for our community JavaScript experts, I thought I'd share Zsolt's post in hopes it might help you out!
- martinyeamanCommunity Member
Thanks Becca, I'm after code that copies the users input into the clipboard.
I have created a simple scene with just a Data Input Text Box and a button in Storyline. The object trigger is the button which executes JS to copy their text input into clipboard.
"Button 1
Execute Javascript
When the user clicks button 1"
This is published to Review 360 and hosted in a Rise course.
Related Content
- 12 months ago
- 12 months ago
- 12 months ago
- 12 months ago
- 8 months ago