score:1

Accepted answer

I would change .attr("fill", "yellow") to .style("fill", "yellow")

Using .attr() results in <rect fill="yellow" ...> instead of <rect style="fill: yellow;" ...> which might be causing your problem.


Related Query