Answered
Access SVG object with JavaScript
I want to add custom behavior to SVG images in my Captivate project though JavaScript code. However, it seems like the SVG object is not loaded when the JavaScript code attempts to access it. The object is listed in the innerhtml parameter of the surrounding div (SVG_1c contains SVG_1c_object), but this element comes back empty or null no matter how I try to access it.
var mySVG = document.getElementById("SVG_1c");
console.log(mySVG.innerHTML);
^This returns an empty string.
var mySVG = document.getElementById("SVG_1c_object");
console.log(mySVG);
^This returns null (undefined).
Is there a way to access this object in HTML, perhaps by waiting for the image to be loaded before running the rest of the script?
