Execute Javascript

May 24, 2019

Hello Everyone,

I need some help here. What I'm trying to do seems simple enough, but it's not working for me. I've already searched through the other posts but could not find any that deal with this precise issue.

I'm trying to use Execute Javascript to add a div to the published Storyline page dynamically, and then to add an image to that div. I want the div and the image in it to coexist along with the Storyline project on the same page. All this must be accomplished dynamically. I don't want to have to edit the published HTML files to do this.

This is the code I'm using to accomplish this task. It works perfectly in any plain HTML page, whether from the head or the body (within the appropriate <script></script> tags, of course).

onload = function() {
var myDiv = document.createElement("div");
myDiv.innerHTML = '<img src="images/sine.png">';
document.body.appendChild(myDiv);
};

However, it does nothing from within the Execute Javascript trigger. I am not using the <script></script> tags in Execute Javascript. What am I doing wrong?

Thanks for any help.

5 Replies

This discussion is closed. You can start a new discussion or contact Articulate Support.