I'm trying to change a clicked circle's fill to black in D3.js v5. This is what I have
svg.selectAll(".token")
.data(places)
.enter()
.append("circle")
.attr("r", place_radius - 5)
.attr("cx", (d) => d.x)
.attr("cy", (d) => d.y)
.attr("class", "token")
.on("click", (d) => {
d3.select(this)
.attr("fill", "black")
});
I'm getting the error this.setAttribute is not a function
. I know the clicking is working correctly because I am able to console.log the data value.