title: Is there an equivalent of jquery .empty() in d3?
body: <p>In jQuery I can clear/empty a div with the following:</p>
  
  <pre><code>$("#graph").empty()
  </code></pre>
  
  <p>so the above command would clear/empty the following div if it had any tags inside it <code>&lt;div id="graph"&gt;&lt;/div&gt;</code>.</p>
  
  <p>Is there an equivalent way to do this is d3? </p>
  
  <p>see my <a href="https://plnkr.co/edit/NNPNQVXg9Eff8WMT0zjb?p=preview" rel="nofollow noreferrer">PLUNKER here</a></p>
  
  <p>Snippet of Plunker code here:</p>
  
  <pre><code>&lt;div id="mylist"&gt;hello test1&lt;/div&gt;
  
  
  &lt;div id="graph"&gt;hello test2&lt;/div&gt;
  
  &lt;script&gt;        
          $("#graph").empty() // comment out to not empty the div
  &lt;/script&gt;        
  </code></pre>
  
  <hr>
  
  <h2>EDIT1</h2>
  
  <p><a href="https://plnkr.co/edit/Wba8CaJ4T1Ii5eYCRNBd?p=preview" rel="nofollow noreferrer">PLUNKER</a> for my reference based on answer below.</p>