Javascript only working on start page
Hi Storyline-lovers,
I assigned the following Javascript-code t a button. It is working if I put the button on the start page of my project.
If I put it on another slide it is not working. I just copy the working button, and pasting it into another slide. And it is doing nothing. The browser console says:
(anonym) | @ | bootstrapper.min.js:2 | |
(anonym) | @ | bootstrapper.min.js:2 | |
h | @ | bootstrapper.min.js:37 | |
exeJavaScript | @ | slides.min.js:2 | |
v | @ | bootstrapper.min.js:29 | |
p | @ | bootstrapper.min.js:29 | |
u | @ | bootstrapper.min.js:29 | |
s.trigger | @ | bootstrapper.min.js:29 | |
triggerAction | @ | slides.min.js:2 | |
_e | @ | bootstrapper.min.js:37 | |
Pi | @ | bootstrapper.min.js:37 | |
(anonym) | @ | bootstrapper.min.js:37 | |
(anonym) | @ | bootstrapper.min.js:37 | |
(anonym) | @ | bootstrapper.min.js:37 | |
_e | @ | bootstrapper.min.js:37 | |
(anonym) | @ | bootstrapper.min.js:37 | |
applyMethod | @ | bootstrapper.min.js:2 | |
executeAction | @ | slides.min.js:2 | |
executeActions | @ | slides.min.js:2 | |
(anonym) | @ | slides.min.js:2 | |
forEach | @ | slides.min.js:2 | |
executeFilteredPlayerEvent | @ | slides.min.js:2 | |
_e | @ | bootstrapper.min.js:37 | |
e | @ | bootstrapper.min.js:37 | |
triggerEvent | @ | slides.min.js:2 | |
d | @ | slides.min.js:2 |
JS-CODE:function kopiereTextInZwischenablage() {
var manuellEingefuegterText = "Workplace / Laptop"; // Hier den gewünschten Text eingeben
var textBereich = document.createElement("textarea");
textBereich.value = manuellEingefuegterText;
document.body.appendChild(textBereich);
textBereich.select();
textBereich.setSelectionRange(0, 99999); // Für mobile Geräte
try {
var copySuccessful = document.execCommand("copy");
alert("Text wurde in die Zwischenablage kopiert: \n\n" + manuellEingefuegterText);
} catch (err) {
console.error("Kopieren in die Zwischenablage fehlgeschlagen", err);
}
document.body.removeChild(textBereich);
}
kopiereTextInZwischenablage();
Anybody has an idea?
Thorsten