Copy link to clipboard
Copied
I wrote some custom Javascript that generates some text. The Javascript successfully executes when the movie gets to that slide (On Enter: Execute Javascript) but I can't seem to get the generated text to appear within any Captivate screen object.
I created a Captivate text entry box, found it's ID value and tried using the Javascript call:
document.getElementById("myTextBox_inputField").innerHTML="Text from Javascript";
but I can't seem to get the text from my Javascript output to a Captivate object. I feel like I'm missing something obvious with this one....
Thanks in advance,
Rich
Copy link to clipboard
Copied
You have to store that text in a user variable, defined in Captivate, which can be displayed in a text container.
Use the method SetVariableValue which is available in the common JS API for Captivate. More details:
Learn about the Common JavaScript interface for Adobe Captivate
Copy link to clipboard
Copied
The syntax for an Input is "value", not innerHTML. You'll need to set a timeout to ensure the element is in the DOM first.
setTimeout(function()
{
var myBox = document.getElementById("myTextBox_inputField").value = "Text from Javascript";
}, 0200);