Converting the DOM element in a String

Posted by Hsm Sharique Hasan on Stack Overflow See other posts from Stack Overflow or by Hsm Sharique Hasan
Published on 2012-12-14T23:20:41Z Indexed on 2012/12/15 5:04 UTC
Read the original article Hit count: 227

Filed under:
|
|

I am working on svg. I made some shapes in svg using my javascript code. Now what i have to do is to get that code of svg which has been made as i draw some thing. i want to get that code in a form of string so for the sake of reuse or if can put that code in a .svg file it outputs the same what i made by myself using my javascript code. Like My code made this

 <svg xmlns="http://www.w3.org/2000/svg"
 xmlns:xlink="http://www.w3.org/1999/xlink"
 width="500" height="500" id="one">
<g id="container">
    <rect id ="rect" x="0" y="0" width="0" height="0" fill="pink"
          stroke="blue" stroke-width="2" />

</g>

Now what should i do to get all the code from to in a form of string and i can print that.

© Stack Overflow or respective owner

Related posts about html

Related posts about dom