I load a SVG file from an object tag and access its content from a JavaScript.
$(document).ready(function() {
$(window).load(function () {
var a = document.getElementById("svgObj");
var svgDoc = a.contentDocument;
// Do something on svgDoc
});
});
This works fine when I explicitly have a tag in a html page. When I dynamically create an object tag in JavaScript, "svgDoc" is null and I can seem to get contentDocument of the loaded object tag. I've tried using the timer to wait until svg file gets loaded but resulted in getting null object. Is it possible to get "contentDocument" by dynamically creating an object tag and loading svg file on the fly?
http://jsfiddle.net/katakuri/05doayb5/
Thanks, katakuri