Free D3 Remove Everything Inside Svg To remove the svg content (aka child elements), you can use the selectall () and remove () methods provided by the d3. Setting the id attribute when appending the svg element can also let d3 select so remove () later on this element by id :