D3 insine text and image

by Binabh

JavaScript

var svg = d3.select("body").append("svg")
            .attr("width", 500)
            .attr("height", 500)
            ;
svg
  .data([{ foo: 'foo <img width=20 src="https://www.seekpng.com/png/full/114-1149126_apple-clipart-black-and-white-image-small-clip.png"> foo', bar: 'bar' }])
  .append("foreignObject")
  .attr("width", 100)
  .attr("height", 100)
  .html(function(d) {
    return  d.foo + '</br>' + d.bar
  })