I need to edit (using javascript) an SVG document embedded in an html page.
When the SVG is loaded, I can access the dom of the SVG and its elements. But I am not able to know if the SVG dom is ready or not, so I cant’ perform default actions on the SVG when the html page is loaded.
To access the SVG dom, I use this code:
var svg = document.getElementById('chart').getSVGDocument();
where ‘chart’ is the id of the embed element.
If I try to access the SVG when the html document is ready, in this way:
jQuery(document).ready( function() { var svg = document.getElementById('chart').getSVGDocument(); ...
svg is always null. I just need to know when it is not null, so I can start manipulate it. Do you know if there is a way to do it?
You could try polling every so often.