title: How to get the parent node of d3.select
body: <p>again, I have no idea how to get the needed information.</p>
  
  <p>For the following SVG-Objects, I need to get the group tag:</p>
  
  <pre><code>&lt;g id="a39" style="touch-action: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);" transform="translate(0 0)"&gt;
    &lt;line class="hotwater graphic selectedGraphic" x1="400" y1="-70" x2="670" y2="-70" id="g39"&gt;&lt;/line&gt;
    &lt;line class="hotwater graphic selectedGraphic" x1="400" y1="-50" x2="670" y2="-50" id="g39"&gt;&lt;/line&gt;
  &lt;/g&gt;
  
  &lt;g id="a40" style="touch-action: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);"&gt;
    &lt;polyline class="warmbrinewater graphic selectedGraphic" fill="none" points="300,-20,240,-160,50,-90,300,-20" id="g40"&gt;&lt;/polyline&gt;
  &lt;/g&gt;
  </code></pre>
  
  <p>My selector is the class <code>selectedGraphic</code>. I need to assign a translation to the encapsulation group-tag. But I have no idea how to get the parent Nodes...</p>
  
  <pre><code>d3.selectAll('.selectedGraphic').**FIRSTELEMENTSPARENT**.attr("transform", "translate(" + xPos + " " + yPos + ")");
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>Thanks, Carsten</p>
  
  <p>UPDATE:</p>
  
  <p>Actually I solve it this way:</p>
  
  <pre><code>var sel = document.getElementsByClassName('selectedGraphic');
  for (var i = 0; i &lt; sel.length; i++) {
      sel[i].parentNode.setAttribute('transform', "translate(" + xPos + " " + yPos + ")");
  }
  </code></pre>
  
  <p>But I'd appreciate to solve it, using d3.</p>