title: How get SVG code from html page, using jQuery or JavaScript?
body: <p>I have simple HTML page with svg like this:</p>
  
  <pre><code>&lt;div id="plan"&gt;
  &lt;svg xmlns="http://www.w3.org/2000/svg" version="1.1"&gt;
  &lt;g id="layer3"&gt;
     &lt;rect width="105.71429" height="80" x="351.42856" y="152.36218" id="rect1" style="fill:#008000"&gt;&lt;/rect&gt;
     &lt;rect width="120" height="85.714287" x="500" y="389.50504" id="rect2" style="fill:#008000"&gt;&lt;/rect&gt;
  &lt;/g&gt;
  &lt;/svg&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>How i can get the string:</p>
  
  <pre><code>&lt;rect width="105.71429" height="80" x="351.42856" y="152.36218" id="rect1" style="fill:#008000"&gt;&lt;/rect&gt; 
  </code></pre>
  
  <p>from this svg. I can use jquery and jquery svg. I try:</p>
  
  <pre><code>    $(document).ready(function() {
      console.log($("#plan #rect1")[0]);
  })
  </code></pre>
  
  <p>In console i take this string, but i must get string in variable like this:</p>
  
  <pre><code>var str = $("#plan #rect1")[0];
  </code></pre>
  
  <p>variable str is [object SVGRectElement]
  [enter link description here]<a href="http://jsfiddle.net/GU3Yn/3/" rel="nofollow noreferrer">1</a></p>