Accepted answer


d3.selectAll("circle").style("fill", "green");

Or:"fill", "PaleGoldenRod");

Explanation: d3.selectAll will return a selection, which can be acted upon using the functions described in this API:

However, as soon as you do forEach, the internal variable returned each time as circle will be an actual DOM element - no longer a selection, and therefore no style function attached.

Related Query

More Query from same tag