Bring to front an SVG element with D3

Posted on February 5, 2021

A little reminder about how to bring to front an element in an SVG using D3.js.

The quick solution is to append the element again in the same container:

elements.on('click', function(){
  this.parentNode.appendChild(this)
})

Here a live example.