I have an svg graphics inserted in the page with an embed or object tag:
<object data="graphics.svg" type="image/svg+xml" id="graphics" />
The image is loading properly and I can see its SVG structure with the browser debugger. I see all the elements ids and attributes but it seems to me there is no way to select those elements with my scripts on page:
$('#graphics path').length; // 0 (jQuery)
$('path').length; // 0 anyway
Is it possible to browse the graphics elements as usual?
It will show up as a separate document, similar to an iframe. You can access it like this:
Note that it is important to wait until the svg file is loaded; you might want to put your code in the
object
element’sonload
event handler, like this: