JavaScript to export code inside a div element?
I have a web document that contains an element div
.
This element div
comprises a child element svg
(which itself contains primitives SVG: text
, path
etc).
Ultimately, I would like to export this element svg
to my own standalone SVG document. (I can run this SVG document with imagemagick
and do post quality numbers.)
Is there a JavaScript that "dumps" the content of an element div
with the desired header <?xml>
to a file?
a source to share
You might want to look at the jQuery SVG plugin , specifically the toSVG () method in the SVG Defs section. You won't be able to save the document via Javascript / jQuery, but you will be able to open a new window with the document's content and use the browser's save function to save the text document to a file.
a source to share