title: Insert element as sibling using D3js
body: <p>I have an html structure like this</p>
  
  <pre><code>&lt;div&gt;
      &lt;div&gt;&lt;span id="span1"&gt;Test 1&lt;/span&gt;&lt;/div&gt;
      &lt;div&gt;&lt;span id="span2"&gt;Test 2&lt;/span&gt;&lt;/div&gt;
      &lt;div&gt;&lt;span id="span3"&gt;Test 3&lt;/span&gt;&lt;/div&gt;
      &lt;div&gt;&lt;span id="span4"&gt;Test 4&lt;/span&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I have to insert an svg element, using jQuery I can easily do it like</p>
  
  <pre><code>for(var i in arr)
      $('.span' + i).parent().append('&lt;svg /&gt;')
  </code></pre>
  
  <p>How can I acheive the same using D3.js? as d<code>3.select('.span' + i).parent</code> is giving error <code>parent is not a function</code></p>