Bring to front an SVG element with D3

• 1 min read

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.